Environmental Variables: Variables that are available to your shell. they can be used in scripts that are run from the shell.
# View list of all your environment variables.
env
# This shows paths for all executable programs:
echo $PATH
# Create your own environmental variable:
export MY_ENV_VAR="My custom environmental var"
# Check if it worked using grep:
env | grep MY_ENV_VAR
# Make permanent variables
vi ~/.zshrc
# Now add your custom variables in
export MY_ENV_VAR="My custom environmental var"
export PATH="$PATH:$HOME/bashscripts"
# Then run this to take affect instead of restarting your terminal
source ~/.zshrc
# Remove variable
unset MY_VAR
Top comments (0)