用和的邏輯連結命令

&& 連結兩個命令。第二個只有在第一個成功退出時才會執行。 || 鏈兩個命令。但是第二個只有在第一個出現故障時才會執行。

[ a = b  ] && echo "yes" || echo "no"

# if you want to run more commands within a logical chain, use curly braces
# which designate a block of commands 
# They do need a ; before closing bracket so bash can diffentiate from other uses
# of curly braces
[ a = b ] && { echo "let me see." 
               echo "hmmm, yes, i think it is true" ; } \
          || { echo "as i am in the negation i think " 
               echo "this is false. a is a not b."  ; }
# mind the use of line continuation sign \
# only needed to chain yes block with || ....