Hacker News new | ask | show | jobs
by ori_b 5130 days ago
> I can't even count the number of times I wanted to pipe an output of one program to multiple others

      ls | tee >(frob x) | grep y
should output the output of ls to both 'grep x' and 'grep y'. The '>(foo)' syntax in bash will create a subshell to run the pipeline in the parens, and evaluate to the name of the FD for the pipeline (eg, /dev/fd/42).

For multiple inputs, similarly:

     grep foo <(ls dir1) <(cat somefile)
1 comments

Thanks! I didn't know about tee. My gripes were from working with something like this ( http://i.imgur.com/LnAvV.jpg ), and then trying to emulate that in CLI. (The picture shows a graph-based image processing system, Blender's compositing mode) --- Source: http://www.blender.org/typo3temp/pics/ca33eb4833.png
That should probably get a domain-specific tool regardless; Generalizing the command line UI is probably going to end up getting too hairy for the common case.