[ 與 [[ 的差異 (Left square bracket)

在寫 shell script 時,[[[ 到底用起來有什麼不一樣?查出來記錄起來:「What is the difference between double and single square brackets in bash?」。

第一高分的答案 (由 Kyle Brandt 回答) 與第二高分的答案 (由 abhiomkar 回答) 都值得看,尤其是 abhiomkar 寫的範例很清楚:

  $ [ a < b ]
 -bash: b: No such file or directory
  $ [[ a < b ]]

對判斷式子裡面的解讀是不一樣的。

This entry was posted in Computer, Murmuring, Software and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *