任何人都可以帮助下面的脚本有什么问题吗?它表示密码已成功更改,但密码仍为旧密码。我正在运行此脚本来更改检查点SPLAT防火墙专家密码,该密码使用ssh直接登录到专家模式。期望脚本使用ssh更改密码
#!/usr/bin/expect
set username admin
set oldpass sam$$$
set newpass abc.123
spawn ssh -l $username 192.168.1.10
expect "assword:"
send "$oldpass\r"
expect "# "
sleep 1
send "passwd\r"
expect "Enter new expert password:"
send "$newpass\r"
expect "Enter new expert password (again):"
send "$newpass\r"
expect eof"
expect "# "
send "exit\n"
[[email protected] ~]$ ./test.sh
spawn ssh -l admin 192.168.1.10
[email protected]'s password:
Last login: Thu Oct 30 18:41:52 2014 from 192.168.1.5
[[email protected]]# passwd
Enter new expert password:
Enter new expert password (again):
Expert password has been changed
脚本对我来说很好看。由于“期待”而没有看到问题。可能是你失踪的其他东西。 – Dinesh 2014-10-30 14:09:56