Last active
October 28, 2023 23:24
-
-
Save avesus/394fea04b34471fdf23d to your computer and use it in GitHub Desktop.
Unix style
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
program > file # write program stdout to file | |
program1 | program2 # send stdout of program1 to stdin of program2 | |
program < file # write file to program stdin | |
program1 && program2 # exec program2 only if program1 returns 0 | |
program1; program2 # exec program2 ever if program1 failed | |
cmd1; cmd2; cmd3 & - will only execute cmd3 in the background | |
cmd1 && cmd2 && cmd3 & - will execute the entire chain in the background IF there are no errors. | |
To cater for unconditional execution, using parenthesis solves this : | |
(cmd1; cmd2; cmd3) & - will execute the chain of commands in the background, even if any step fails. | |
\ - multiline command | |
program1 || program2 - run program2 if program1 failed | |
program1 < srcfile | program2 | program3 > dstfile - pipeline with srcfile on input and dstfile on output | |
mkfifo fifo_file_path - creates a pipe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment