用和的逻辑链接命令
&& 链接两个命令。第二个只有在第一个成功退出时才会运行。 || 链两个命令。但是第二个只有在第一个出现故障时才会运行。
[ 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 || ....