Using && and ||
When stringing together more than two commands, you may want to
control the running of the second command based on the outcome of
the first command. You can use:
- &&
- If the command that precedes && completes successfully, the command following && is run. Leave a space on either side of the && operator: command && command.
- ||
- If the command that precedes || fails, the command following || is run. Leave a space on either side of the || operator: command || command.