I have cmd1 and cmd2.
cmd1 && cmd2 will not run cmd2 if cmd1 fails.
cmd1 || cmd2 will run cmd2 if cmd1 fails
How do I run cmd2 regardless of whether cmd1 succeeds or not?
To execute cmd2 regardless of whether the previous one result is, separate your command with semicolons or newlines:
cmd1; cmd2 # or cmd1 cmd2 If set -e is enabled, add || true to ignore the result of the preceding command:
set -e cmd1 || true; cmd2 # or cmd1 || true cmd2 cmd1 & cmd2. This way cmd2 won't wait for cmd1 to finish before running. set -e enabled. In this case one can do cmd1 || true; cmd2. (Replace ; with new line if needed.)