I don't understand why a carriage return/line feed, or as you say "Enter/Return" key press would move the cursor to the beginning of the current line. It should move it to the beginning of the next line?
I'm sorry, I thought that smaller example would make the question easier to answer - looks like I was wrong there haha Ok, here's my full script and output. Hopefully this will be able to convey the full picture better:
********************
SCRIPT:
#!/usr/bin/expect
set pass [lindex $argv 0]
set user "myUsername"
set src "mySourceFile.name"
set dest "/myRemoteDirectory/myDestFile.name"
spawn scp -o StrictHostKeyChecking=no $src $user@myhost:$dest
expect {
;"password:" {send "$pass\r";exp_continue};}
********************
OUTPUT:
[user@localHost ~]$ ./copyFile.sh myPassword
spawn scp -o StrictHostKeyChecking=no .bashrc
user@remoteHost:/myRemoteDirectory/myDestFile.name
user@remoteHost's password:
Permission denied, please try again.
user@remoteHost's password:
Permission denied, please try again.
user@remoteHost's password:
Permission denied (publickey,gssapi-with-mic,password).
lost connection
********************
Now, when I change this line:
- set pass [lindex $argv 0]
to this:
- set pass actualPassword
It works perfectly fine and I get the following output. Any ideas?
********************
[user@localHost ~]$ ./copyFile.sh
spawn scp -o StrictHostKeyChecking=no .bashrc
user@remoteHost:/myRemoteDirectory/myDestFile.name
user@remoteHost's password:
.mySourceFile.name