I was able to use expect successfully, I think, but what to do after?
Here's my goal:
use expect to log in to a remote terminal with sftp
copy over some files from my local computer to the remote computer
run a process on the remote computer on these files
copy the output back to my local computer
done
So far I can successfully log in with this script:
1 #!/bin/bash
2 HOST="hostAddress"
3 USER="logInName"
4 PASS="password"
5 LS="ls"
6
7
8 expect -c "
9 spawn sftp $USER@$HOST
10 expect "Password:"
11 send $PASS
12 interact
13 "
14 echo $LS
15 ls
16 ls
The problem is that it only logs in, I see the prompt "sftp>" but the "ls" is not being typed
. I spammed a lot of ls but none of them are being typed.