Bash/Expect Script for SSH

前端 未结 4 459
旧时难觅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:28

    A possibility is to pass the IP address as a parameter in your Expect script:

    set host_ip [lindex $argv 0]
    

    and then make a shell script, calling your Expect script inside a while loop:

    ips_file="list.txt"
    
    while read line
    do
        your_expect_script line
    done < $ips_file
    

提交回复
热议问题