tee to a file descriptor $ tee >(cat – >&2) the tee command does fine with file names, but not so much with file descriptors, such as &2 (stderr). This uses process redirection to tee to the specified descriptor.
In the sample output, it\’s being used to tee to stderr, which is connected with the terminal, and to wc -l, which is also outputting to the terminal. The result is the output of bash –version followed by the linecount
* View this command to comment, vote or add to favourites * View all commands by camocrazed
commandlinefu.com
by David Winterbottom (codeinthehole.com)
URL: http://feedproxy.google.com/~r/Command-line-fu/~3/pRzpSThZ6IQ/tee-to-a-file-descriptor
Related articles by Zemanta
- coproc help – a new feature in bash (amit-agarwal.co.in)
- The Tar Pipe (extracheese.org)
- imabonehead: Monitor Linux file system events with inotify (ibm.com)
- imabonehead: How to Recover Deleted Files From a EXT3 Partition|TechMantras (techmantras.com)
Link to this post!