Named pipes

Last friday the guy behind the twinview setup on the desk in front of me tipped me on named pipes. Bash uses named pipes in a really neat way. When you enclose a command in parenthesis, the command is actually run in a subshell; that is, the shell clones itself and the clone interprets the command(s) within the parenthesis. Since the outer shell is running only a single command, the output of a complete set of commands can be redirected as a unit.

Since I learned this I mostly used it in combination with the diff command:

diff <(curl http://www.liekeensofie.nl//scripts/lightbox.js)
<(curl http://www.maas-frensch.com/sjoerd/wp-content/plugins/wp-lightboxJS/lightbox.js.php)

The above compares two webpages without the need of temporary files!

This entry was posted in linux. Bookmark the permalink.

One Response to Named pipes

  1. Pingback: Named pipes in OSX? at log4p

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>