有人能告訴我爲什麼這個腳本不起作用嗎?我得到Bash腳本,OR語句上的語法
./FileDirTest.sh: line 10: [: missing `]'
./FileDirTest.sh: line 10: n: command not found
./FileDirTest.sh: line 13: [: missing `]'
./FileDirTest.sh: line 13: n: command not found
這是我的腳本。
if [ -d "$PASSED1" ]
then echo "Do you want to execute whole directory?(Y/N)"
read answer
if [ "$answer" == "y" || "$answer" == "Y" ] ;
then echo "Execute"
fi
if [ "$answer" == "n" || "$answer" == "N" ] ;
then echo "No"
exit 1
fi
fi
我確定它是簡單的。我是新來的。
嘗試[shellcheck(http://shellcheck.net),它會自動檢測這樣 –