【发布时间】:2013-12-30 13:21:06
【问题描述】:
我想循环运行这个脚本。
需要做的是读取该文件中包含 IP 地址的文件,例如:
10.0.0.0
10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4
并在上面列出的每个 ip 上运行此脚本。
这就是我所拥有的:
#!/usr/bin/expect
spawn telnet 10.0.0.0
expect "User Name :"
send "username\r"
expect "Password :"
send "password\r"
expect ">"
send "4\r"
expect "*#"
exit
如何让上面的脚本在 txt 文件中工作每个 IP。
【问题讨论】:
标签: bash loops while-loop telnet expect