Use parentheses ()’s to combine the commands into a single process, which will concatenate the stdout of each of them.
Example 1 (note that $
is the shell prompt):
$ (echo zzz; echo aaa; echo kkk) | sort
aaa
kkk
zzz
Example 2:
(setopt; unsetopt; set) | sort
More Related Contents:
- Quick-and-dirty way to ensure only one instance of a shell script is running at a time
- Pipe output and capture exit status in Bash
- How can I detect if my shell script is running through a pipe?
- Quick-and-dirty way to ensure only one instance of a shell script is running at a time
- How does Ctrl-C terminate a child process?
- Bash conditional based on exit code of command
- Set a parent shell’s variable from a subshell
- Variables getting reset after the while read loop that reads from a pipeline
- Piping and Redirection
- How to kill all subprocesses of shell?
- How to pipe stdout while keeping it on screen ? (and not to a output file)
- pipe stdout and stderr to two different processes in shell script?
- Get exit code from subshell through the pipes
- When does command substitution spawn more subshells than the same commands in isolation?
- Using groovy, how do you pipe multiple shell commands?
- Left side of pipe is the subshell?
- How to wait on all child (and grandchild etc) process spawned by a script
- What does 2>&1 mean here?
- How to reload .bashrc settings without logging out and back in again?
- How do I iterate over a range of numbers defined by variables in Bash?
- How can I pipe stderr, and not stdout?
- Bash command line and input limit
- Using the RUN instruction in a Dockerfile with ‘source’ does not work
- Why start a shell command with a backslash?
- Is there a TRY CATCH command in Bash
- Is mixing getopts with positional parameters possible?
- Pipe, standard input and command line arguments in Bash
- What does “export” do in shell programming? [duplicate]
- How can I convert tabs to spaces in every file of a directory?
- Use GNU find to show only the leaf directories