Menu

quick question

bekzod f
2016-03-17
2018-08-13
  • bekzod f

    bekzod f - 2016-03-17

    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

     
  • Joe Walker

    Joe Walker - 2018-08-13

    "Y$fr5dk" won't work unless you escape the $ with a \ like this:
    "Y\$fr5dk"

     

Log in to post a comment.

MongoDB Logo MongoDB