Setting Environment Variables in Unix Shell

Setting environment variables allows you to reference sensitive data, like passwords and API keys in an application, without making them publicly visible online or in a public repository.

Example:

becomes…

To do this, first check to make sure you are using a bash shell:

Then edit your “~/.bashrc” file and add:

Save the file and you’re all set. You will have to open a new shell or restart your terminal to continue.

Leave a Reply

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