til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as an open source contributor and product manager

View project on GitHub

Set Environment From File

I ran into this challenge where a given CLI client (Jira) relies on the password being transported via an environment variable.

Since my dot files are handled via a dot file manager, I do not want to set a password directly in those files. So I isolated the password to a separate file and looked into how I could get this exported to the environment.

v=$(cat $HOME/.JIRA_API_TOKEN) export JIRA_API_TOKEN=$v

This can then be added to your .bashrc or .zshrc.

Resources and References

  1. StackOverflow: “How to read a file into a variable in shell?”