Bash/Expect Script for SSH

前端 未结 4 498
旧时难觅i
旧时难觅i 2021-01-05 06:36

I am new to Expect and scripting in general. I am trying to make a few scripts to make my life a bit easier when pulling network device configurations. I managed to create a

4条回答
  •  庸人自扰
    2021-01-05 07:13

    Or use set ip [gets stdin] to the IP address from the user input.

    For example,

    puts "Enter your IP address\n"
    set ip [get stdin]
    

    Use this in spawn. We can do the same for multiple IP addresses using a loop -

    spawn ssh $ip -l admin
    

提交回复
热议问题