请问各位我要如何借由expect自动登入从参数送登入密码含有"$" 钱符号的密码
我用同一个脚本自动登入没有问题可是当机器密码含有"$"时他会试着登入三次之后送出登入错误的讯息
我用debug去看发现如密码含有"$" expect自动加了"{", "}", 有试着在密码前后加上单引号或双引号 不过结果都一样
谢谢
$/usr/bin/expect -d expect.sh 10.1.1.10 1234\$123
$/usr/bin/expect -d expect.sh 10.1.1.10 "1234\$123"
$/usr/bin/expect -d expect.sh 10.1.1.10 '1234\$123'
执行结果
expect: does "\r\n" (spawn_id exp6) match glob pattern "*?assword:*"? no
"*yes/no*"? no
Permission denied, please try again.
root@10.1.1.10's password:
expect: does "\r\nPermission denied, please try again.\r\r\nroot@10.1.1.10's password: " (spawn_id exp6) match glob pattern "*?assword:*"? yes
expect: set expect_out(0,string) "\r\nPermission denied, please try again.\r\r\nroot@10.1.1.10's password: "
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "\r\nPermission denied, please try again.\r\r\nroot@10.1.1.10's password: "
send: sending "{1234$123}\r" to { exp6 }
expect: continuing expect