最近剛開始學習Linux Shell語言
看的是鳥哥的私房菜,《鳥哥的Linux私房菜 基礎學習篇(第三版)PDF高清晰 》下載見 http://www.linuxidc.net/thread-2268-1-1.html 。裡面有講到執行shell腳本有兩種方法:
1. 設置執行屬性: chmod 755 file
執行(如果已經在當前目錄) : ./file
2. 使用: sh file 執行
.但是在vmware裡裝的Ubuntu 11.10卻無法執行
使用第二種方法執行時出現 :
test04_for.sh: 1: declare: not found
test04_for.sh: 3: Syntax error: Bad for loop variable
解決方法:
在終端中輸入:
sudo dpkg-reconfigure dash
然後出現的界面中選擇 NO
然後就能正確運行了。
更多Ubuntu相關信息見Ubuntu 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=2