Skip to content

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

1 thought on “Process substitution in bash”

Leave a Reply

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