How to use multiple commands after “||” in Bash

You can group multiple commands within { }. Saying:

some_command || { command1; command2; }

would execute command1 and command2 if some_command exited with a non-zero return code.


{ list; }

Placing a list of commands between curly braces causes the list to be executed in the current shell context. No subshell is created. The
semicolon (or newline) following list is required.

Leave a Comment