AND list
Two commands joined by &&, where the second runs only if the first succeeds.
In more detail
mkdir demo && cd demo stops before cd if the directory could not be made. The whole list returns the status of the last command that ran.
Related terms
- OR list — Two commands joined by ||, where the second runs only if the first fails.
- exit code — A number a process returns when it finishes: 0 means success, anything else means something went wrong.
- if statement — A statement that runs a block of code only when a condition holds, optionally with an else block for when it does not.
Taught in
- Making, Copying, Moving And Removing — Bash Scripting & Command Line Automation
- The Unquoted Variable: Splitting And Globbing — Bash Scripting & Command Line Automation
- Command Substitution And Subshells — Bash Scripting & Command Line Automation
- Exit Codes, And What Success Means — Bash Scripting & Command Line Automation
- trap, Cleanup And Temporary Files — Bash Scripting & Command Line Automation
- Permissions And Ownership — Bash Scripting & Command Line Automation