我通过shell脚本中的命令行传递Expect中的参数.
我试过了
#!/usr/bin/expect -f
set arg1 [lindex $argv 0]
spawn lockdis -p
expect "password:" {send "$arg1\r"}
expect "password:" {send "$arg1\r"}
expect "$ "
但它不起作用.我该怎么修?
我通过shell脚本中的命令行传递Expect中的参数.
我试过了
#!/usr/bin/expect -f
set arg1 [lindex $argv 0]
spawn lockdis -p
expect "password:" {send "$arg1\r"}
expect "password:" {send "$arg1\r"}
expect "$ "
但它不起作用.我该怎么修?
如果你想阅读论点,你可以通过
set username [lindex $argv 0];
set password [lindex $argv 1];
然后打印出来
send_user "$username $password"
那个脚本会打印出来
$ ./test.exp user1 pass1
user1 pass1
可以使用调试模式
$ ./test.exp -d user1 pass1