xzased
August 22nd, 2010, 01:09 AM
I have a bash script with the following command:
VAR=$(expect -c "
spawn ssh $USER@$HOST -p 2020
expect \"password:\"
send \"$PASS\r\"
expect \"\\\\$\"
send \"uname -r\r\"
expect -re \"$USER.*\"
send \"logout\"
")
But the -p 2020 option is not working. It returns:
root@127.0.0.1's password: 2020
If I remove the -p option it works ok. How can I write this so it takes the port option? Thanks in advance.
VAR=$(expect -c "
spawn ssh $USER@$HOST -p 2020
expect \"password:\"
send \"$PASS\r\"
expect \"\\\\$\"
send \"uname -r\r\"
expect -re \"$USER.*\"
send \"logout\"
")
But the -p 2020 option is not working. It returns:
root@127.0.0.1's password: 2020
If I remove the -p option it works ok. How can I write this so it takes the port option? Thanks in advance.