Timeline for How can I send stdout to multiple commands?
Current License: CC BY-SA 3.0
14 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 20, 2024 at 22:24 | comment | added | x-yuri | @AAlvz >( also works with the busybox's sh implementation (Alpine Linux). | |
| May 16, 2023 at 9:25 | comment | added | Tilman Vogel | When using tee with pipes (as is the case with >(), it makes sense to take a look at the -p option to allow continue writing to the other pipes even if one of them closes early. | |
| May 21, 2017 at 16:21 | comment | added | Rolf | The tee trick works (thanks!). But it sends everything to standard output as well, which I prints loads of garbage to the console, so I added 2&>/dev/null at the end of the command. | |
| Oct 22, 2016 at 5:39 | comment | added | mklement0 | @Aktau: Indeed, my sample command only work as described in bash and ksh - zsh apparently doesn't send output from output process substitutions through the pipeline (arguably, that's preferable, because it doesn't pollute what is sent to the next pipeline segment - though it still prints). In all shells mentioned, however, it's generally not a good idea to have a single pipeline in which regular stdout output and output from process substitutions is mixed - the output ordering will not be predictable, in a manner that may only surface infrequently or with large output data sets. | |
| Oct 21, 2016 at 9:57 | comment | added | Aktau | ..follow-up. Just tested it on bash. There it works. It would seem that binding to stdout is done differently. | |
| Oct 21, 2016 at 9:56 | comment | added | Aktau | @mklement0 that doesn't appear to be true. On zsh (Ubuntu 14.04) your line prints: 1 1 2 2 3 3 1$ 2$ 3$ Which is sad, because I really wanted the functionality to be as you say it. | |
| S May 31, 2015 at 7:51 | history | suggested | CommunityBot | CC BY-SA 3.0 | subtle grammar fix |
| May 31, 2015 at 7:49 | review | Suggested edits | |||
| S May 31, 2015 at 7:51 | |||||
| Apr 15, 2015 at 2:59 | comment | added | mklement0 | @AAlvz: Good point: process substitution is not a POSIX feature; dash, which act as sh on Ubuntu, doesn't support it, and even Bash itself deactivates the feature when invoked as sh or when set -o posix is in effect. However, it's not just Bash that supports process substitutions: ksh and zsh support them too (not sure about others). | |
| Dec 16, 2014 at 16:31 | comment | added | AAlvz | The >( only works in bash. If you try that using for instance sh it won't work. It's important to make this notice. | |
| Dec 9, 2014 at 4:47 | comment | added | mklement0 | Not a concern with pbcopy, but worth mentioning in general: whatever the process substitution outputs is also seen by the next pipe segment, after the original input; e.g.: seq 3 | tee >(cat -n) | cat -e (cat -n numbers the input lines, cat -e marks newlines with $; you'll see that cat -e is applied to both the original input (first) and (then) the output from cat -n). Output from multiple process substitutions will arrive in non-deterministic order. | |
| Jan 7, 2012 at 15:08 | comment | added | cwd | tee but with two (or more) stdout options - sweet! | |
| Jan 7, 2012 at 15:04 | vote | accept | cwd | ||
| Jan 7, 2012 at 9:29 | history | answered | Mat | CC BY-SA 3.0 |