Hide Environment Variables From Your History
Published by
Nathan Webster
on
Here’s a neat little trick I learned today; if you want to hide the value of an Environment variable from your history/logs, put a space before the export command!

Here’s an example:
export NATHAN=foo
echo $NATHAN
foo export NATHAN=bar
echo $NATHAN
barhistory
10083 export NATHAN=foo
10084 echo $NATHAN
10084 echo $NATHAN
Particularly helpful if you are using secrets as Environment variables and you don’t want these to make it through to centralised logging platforms.
Enjoy!
