如何在shell腳本中使用expect
和send
。Shell腳本自動化
如何自動輸入答案。我試圖用自動輸入密碼的腳本登錄su。這是我試過,但不起作用:
#!/bin/bash
#!/usr/bin/expect
su
expect "Password:"
send -- "test"
的錯誤信息是:
couldn't read file "Password:": no such file or directory
./auto.sh: line 5: send: command not found
我從你的問題中刪除了各種問候,因爲我們確實在這裏幫助你。無論如何,這個問題還不是很清楚。你可以試着重新措辭嗎? –
我應該在這裏添加什麼?呵呵,目標可能是? –
我已添加目標。 –