Created
June 24, 2019 15:01
-
-
Save M-Razavi/ec57b0f80432f3a5eaede6acd7243d95 to your computer and use it in GitHub Desktop.
linux shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; commands separated by a ; are executed sequentially. The shell waits for each command to terminate in turn. | |
&& command after && is executed if, and only if, command before && returns an exit status of zero. You can think of it as AND operator. | |
| a pipe. In expression command1 | command2 The standard output of command1 is connected via a pipe to the standard input of command2. | |
There are more similar control operators, worth to mention: | |
|| command after || is executed if, and only if, command before || returns a non-zero exit status. You can think of it as OR operator. Please note, that | and || are completely different animals. | |
& the shell executes the command terminated by & in the background, does not wait for the command to finish and immediately returns exit code 0. Once again, & has nothing to do with &&. | |
|& a shorthand for 2>&1 | i.e. both standard output and standard error of command1 are connected to command2's standard input through the pipe. | |
Additionally if you use zsh then you can also start command with &| or &!. In this case job is immediately disowned, after startup it does not have a place in the job table. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment