in the .bashrc put
export VARIABLE=value
the name of the environment variable is VARIABLE, you call it $VARIABLE.
if it is a String
export VARIABLE="value"
then you need to reload the .bashrc
source ~/.bashrc
if you use zsh
source ~/.zshrc