aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/tools/bash.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/bash.md b/src/tools/bash.md
index a2b7944..e12d8c0 100644
--- a/src/tools/bash.md
+++ b/src/tools/bash.md
@@ -112,6 +112,22 @@ once.
vim -d <(grep foo bar) <(grep foo moose)
```
+## Command grouping
+
+Execute commands in a group with or without subshell. Can be used to easily
+redirect stdout/stderr of all commands in the group into one file.
+```bash
+# Group commands without subshell.
+v=abc ; { v=foo; echo $v; } ; echo $v
+# foo
+# foo
+
+# Group commands with subshell.
+v=abc ; ( v=foo; echo $v; ) ; echo $v
+# foo
+# abc
+```
+
## Argument parsing with `getopts`
The `getopts` builtin uses following global variables: