Subscribe to
Posts
Comments

Process substitution in bash

There’s a very clever syntax in bash (and several other unix shells) that allows the output / input for subcommands to be hooked together.

http://tldp.org/LDP/abs/html/process-sub.html

This can be used to secure mysql passwords in scripts. e.g.

mysql --defaults-file=<(
printf '[client]\npassword=%s\n' xxxPASSWORDHERExxx
) -u xxxUSERNAMEHERExxx

One Response to “Process substitution in bash”

  1. on 29 Jan 2010 at 6:25 amEric Blair

    Yes, be fascinated by non-standard Bourne shell syntax as the Bash shell slowly de-evolves into a PERL like monstrosity.

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image