I have an error trying to run a .sh file
line 2: spawn: command not found ": no such file or directory bash.sh: line 3: expect: command not found bash.sh: line 4: send: command not found
#!/usr/bin/expect -f
spawn sftp -o IdentityFile=MyFile.ppk [email protected]
expect "XXX.XXX.XXX.XXX.gatewayEnter passphrase for key 'MyFile.ppk.ppk':"
send "myPassword"
Any idea why it happens?
mv bash.sh sftp.exp
bash bash.sh
or sh bash.sh
. Do this:
chmod a+x sftp.exp
./sftp.exp
or /path/to/sftp.exp
or move it to a directory in your $PATH and launch it just with sftp.exp
send "myPassword"
you have to "hit enter": send "myPassword\r"
exp_internal 1
to the top.Good luck, and come back with further questions.