Bash: Using logic expressions as a shorthand for if-then-else control
Bash has a rich set of control structures but it is still common to see logic expressions used a shorthand for if-then-else/tertiary statements. This can provide a curt and single-line ingestable way of controlling the flow of your Bash script. For example: $ [ 1 -eq 1 ] && echo “correct, 1 does indeed equal … Bash: Using logic expressions as a shorthand for if-then-else control