如何預先輸入? - Linux

Adele avatar
By Adele
at 2009-12-27T20:30

Table of Contents

※ 引述《feynman511 (noonee)》之銘言:
: 不好意思 我沒講清楚 重點不是輸入密碼
: 而是當程式跟我要簡單資料的時候 我怎麼預先給
: 而我想到最簡單的例子就是給密碼 抱歉沒說清楚
: 我試過你建議的方式
: 可是bash 對於spawn expect和send 都顯示 command not found
: expect 我有在套件庫找到也裝了
: 可是spawn和send就沒找到
: 請問這兩個指令是要灌什麼才有?
: 謝謝

$ ls -l sudo_apt-get_update.exp <-- 你可能沒有注意到這二行
-rwxr-xr-x <-- 你可能沒有注意到這二行
$ cat sudo_apt-get_update.exp
#!/usr/bin/expect
spawn sudo apt-get update
expect "password"
send "YOUR_PASSWORD\r"
expect "$"

$ expect sudo_apt-get_update.exp <-- 這樣執行也可以..


--
Tags: Linux

All Comments

關於更新pidgin問題

Enid avatar
By Enid
at 2009-12-27T20:26
我照網路講 tar jxvf pidgin-2.3.1.tar.bz2 //解壓縮 cd pidgin-2.3.1 //進入pidgin ./configura //執行 三個命令 make make install //執行完後登出在登入就好了 可是我卡在make 他出現bash: make: ...

open source software 室內設計 f@@

Kelly avatar
By Kelly
at 2009-12-27T18:53
※ 引述《easy1 (e :) y)》之銘言: : 想做一個類似smarthome application : 會跟家裡室內裝置,格局有一點關係 : 或是說 : application的user interface會蠻像一個floor planner : 像這個 : http://www.floorplan ...

如何預先輸入?

John avatar
By John
at 2009-12-27T18:33
※ 引述《feynman511 (noonee)》之銘言: : 假設我現在做的動作裡面有些動作需要手動輸入 : 例如輸入密碼 請問要怎麼寫? : sudo apt-get update : sudo apt=get upgrade : 可是在輸入第一行後系統會跟我要密碼 : 那我該怎麼寫才能讓密碼自動輸入? ...

Wine跑爆爆王

Agnes avatar
By Agnes
at 2009-12-27T14:01
剛剛在試看看能不能用Wine 跑 爆爆王 更改完後 用WIne loader開啟 想說一開始很順 應該可以 結果出現無法登入 這是為什麼呢? 是HackShied 檔掉嗎 ? -- 吼~ ◣ ◢ 傳說只要拔到美洲獅的鬃毛 ˋ新ˊ ...

救命! 中文字型不見

Lily avatar
By Lily
at 2009-12-27T13:21
※ 引述《Adama (So Say We All.)》之銘言: : ※ 引述《terrorist (恐怖份子)》之銘言: : : appearance -andgt; fonts 下面 : : 選 serif 可以看到中文 : : 選 sans 就啥也看不見 或是看到方塊方塊 : : 推 Adama:那我就 ...