diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/bash.md | 9 | ||||
-rw-r--r-- | src/tools/fish.md | 6 | ||||
-rw-r--r-- | src/tools/zsh.md | 12 |
3 files changed, 27 insertions, 0 deletions
diff --git a/src/tools/bash.md b/src/tools/bash.md index 9150963..a2b7944 100644 --- a/src/tools/bash.md +++ b/src/tools/bash.md @@ -104,6 +104,14 @@ command 2>&1 >file 1. duplicate `fd 1` to `fd 2`, effectively redirecting `stderr` to `stdout` 2. redirect `stdout` to `file` +## Process substitution ([ref][psub]) + +Process substitution allows to redirect the stdout of multiple processes at +once. +```bash +vim -d <(grep foo bar) <(grep foo moose) +``` + ## Argument parsing with `getopts` The `getopts` builtin uses following global variables: @@ -227,3 +235,4 @@ complete -F _foo foo ``` [dup2]: http://man7.org/linux/man-pages/man2/dup.2.html +[psub]: https://tldp.org/LDP/abs/html/process-sub.html diff --git a/src/tools/fish.md b/src/tools/fish.md index 117ead2..fd1b2f7 100644 --- a/src/tools/fish.md +++ b/src/tools/fish.md @@ -87,6 +87,12 @@ echo "ls output: "(ls) echo foo >? log ``` +### Process substitution +Redirect output of multiple processes. Same as `<(..)` in bash. +```sh +diff (sort a | psub) (sort b | psub) +``` + ## Control Flow ### `if` / `else` ```sh diff --git a/src/tools/zsh.md b/src/tools/zsh.md index a1302a4..f702655 100644 --- a/src/tools/zsh.md +++ b/src/tools/zsh.md @@ -174,6 +174,18 @@ echo ${(kv)vec} # a aa b bb for k v in ${(kv)vec)}; do ...; done ``` +## I/O redirections + +See [bash - I/O redirection](bash.md#io-redirection) + +## Process substitution + +Process substitution allows to redirect the stdout of multiple processes at +once. +```bash +vim -d <(grep foo bar) <(grep foo moose) +``` + ## Argument parsing with `zparseopts` ```zsh |