4
A
回答
12
您可以使用 「read
」:
$ cat ./test.sh
#!/bin/sh
echo -n "enter the value : "
read my_var
echo "The value is : $my_var"
而且,執行該腳本:
$ sh ./test.sh
enter the value : 145
The value is : 145
+4
Bash:「read」有一些有用的選項,例如-p指定提示: read -p'輸入值:'my_var 有關更多信息,請參閱「幫助閱讀」。 – 2009-12-10 18:02:58
相關問題
- 1. 鍵盤輸入與可編程鍵盤
- 2. 如何從TCL鍵盤輸入數組?
- 3. 如何從JavaScript編程語言的鍵盤輸入內容?
- 4. 如何在android鍵盤中輸入Dot?
- 5. 如何從鍵盤輸入紅寶石?
- 6. 如何從python中的後臺線程讀取鍵盤輸入?
- 7. 從鍵盤讀取輸入
- 8. 試圖從鍵盤輸入
- 9. 從鍵盤輸入數組時出錯
- 10. 鍵盤輸入
- 11. 「adb shell輸入文本」是否模擬軟件鍵盤輸入?
- 12. 如何鍵盤輸入在GUI
- 13. 如何在windows鍵盤上輸入«»
- 14. 如何阻止鍵盤輸入在VB.net
- 15. 從python中讀取鍵盤輸入的原始數據
- 16. 素數與鍵盤輸入
- 17. 鍵盤輸入如何進入終端?
- 18. 如何在循環外部使用BufferedReader從鍵盤輸入數據?
- 19. 在VB.net中從鍵盤輸入獲取應用程序名稱
- 20. 如何編程android鍵盤快捷鍵
- 21. 如何爲Python的「輸入」函數生成鍵盤輸入?
- 22. 從android應用程序中以編程方式控制輸入語言鍵盤。
- 23. 如何通過鍵盤在js矩陣中輸入數字
- 24. 在IOS Iphone中,如何輸入數字鍵盤的負值?
- 25. 如何在java中的鍵盤輸入文件中寫入?
- 26. 如何從鍵盤輸入數學表達式?
- 27. 如何在Android鍵盤中禁用語音輸入鍵
- 28. 如何在bash腳本中輸入鍵盤快捷鍵
- 29. python中的鍵盤輸入
- 30. x86彙編鍵盤輸入沒有INT
請注意,這取決於你的shell的東西也許不同。請重新說明哪個shell:bash,korn,csh – Wayne 2009-12-10 05:53:50