在这里,我创建了执行脚本ansible-playbook
,在执行脚本询问Sudo password
我必须发送哪一个之后(须藤密码)虽然expect
但send
出现以下错误:
脚本 :
$ cat changedns
#!/usr/bin/expect -f
spawn ansible-playbook -i "$1," /home/admin/ansible/test.yml -K
match_max 100000
expect "SUDO password:"
send -- "admin@123\r"
send -- "\r"
expect eof
输出:
$ ./changedns bn
can't read "1": no such variable
while executing
"spawn ansible-playbook -i "$1," /home/adminto/ansible/test.yml -K "
(file "./changedns" line 2)
有人知道如何处理这个问题吗?