3 ms·
You can always setup some named pipes. E.g.: mkfifo named_pipe echo "Hi" > named_pipe & cat named_pipe I used to do this in bash scripts to keep them cleane
by lnanek2 5y ago
You can always setup some named pipes. E.g.:
mkfifo named_pipe
echo "Hi" > named_pipe &
cat named_pipe
I used to do this in bash scripts to keep them cleaner and the lines simpler.
- Too 5y agoHow does error handling together with this work? Can pipefail catch this or does one explicitly need to ‘wait’ for the background processes and check them there?
- cerved 5y agoGuessing that pipefail cares 0% of which filedescriptors are used and only the exit codes of processes
- azalemeth 5y agoNamed pipes and tee (or gnu parallel, depending on the problem) make this semantically much clearer. It's so much better than bracket-and-sed-hell spread out over different lines.
- gnubison 5y agoWhere does sed come into this?
- azalemeth 5y agoIt doesn't necessarily -- I just meant that if you have <(<(...) <(...)) type structures then adding a punctuation-jumble like command in the middle of each subsubshell is a good way to murder readability quickly. Sed, and to a lesser extent, awk, tend to be good examples of tools that (can) use a _lot_ of brackets and symbols...