任何人都可以幫助下面的腳本有什麼問題嗎?它表示密碼已成功更改,但密碼仍爲舊密碼。我正在運行此腳本來更改檢查點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