Tuesday, August 20, 2013

Setting env variables in linux just for single command

Use this pattern:
FOOO=bar bash -c 'echo $FOOO'

Some working and non-working examples:

$ FOOO=bar bash -c 'echo $FOOO'
bar
$ echo $FOOO

$ FOOO=bar echo $FOOO



No comments:

Post a Comment