I'm currently trying to automate a file transfer using the scp command with a shell script and the expect package. Based on what I've seen it seems that I should have
#!/usr/bin/expect -f
But when I did that I still get the errors:
DirectoryChange.sh: line 33: spawn: command not found
couldn't read file "*Password:*": no such file or directory
DirectoryChange.sh: line 35: send: command not found
DirectoryChange.sh: line 36: interact: command not found
The code I have works something along these lines:
#!/usr/bin/expect -f
repository=$PWD"/subdirectory/"
set pass "***********"
cd $repository
spawn scp -r user@host:/copyDirectory/ .
expect "*Password:*"
send "${pass}\r";
interact