|| &&
查了 Stack Overflow
- ||,表示或,从前往后执行,执行第一个真
- &&,前者是真才会接着执行
- ; 表示接着往下执行,不管前者如何
1 #!/bin/bash 2 3 false || echo "Oops, fail" 4 # Oops, fail 5 true || echo "Will not be printed" 6 # 7 true && echo "Things went well" 8 # Things went well 9 false && echo "Will not be printed" 10 # 11 false ; echo "This will always run" 12 # This will always run