HI guys . I have a script to login to cisco router and change some settings . The problem is when:
spawn ssh $ip -l test
expect "Password:"
send "my password\n"
when I put in send my clear password wich has $ sign in the middle expect think that its variable and gives me error. HOw can I tell to programm do not read $ as a separate sign but read it as text ? (for example i may have like this password Y$fr5dk)
2) OR another way is to do is declare passwd as variable so i will need to enter it :
spawn ssh $ip -l test
expect "Password:"
send "$password\n"
it is asking me to enter password but when i try to enter it I don't have enough time to enter password , its kicking me off.
thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
HI guys . I have a script to login to cisco router and change some settings . The problem is when:
spawn ssh $ip -l test
expect "Password:"
send "my password\n"
when I put in send my clear password wich has $ sign in the middle expect think that its variable and gives me error. HOw can I tell to programm do not read $ as a separate sign but read it as text ? (for example i may have like this password Y$fr5dk)
2) OR another way is to do is declare passwd as variable so i will need to enter it :
spawn ssh $ip -l test
expect "Password:"
send "$password\n"
it is asking me to enter password but when i try to enter it I don't have enough time to enter password , its kicking me off.
thank you
"Y$fr5dk" won't work unless you escape the $ with a \ like this:
"Y\$fr5dk"