Environment Variables

What happens when you store this in ~/.bash_profile?

export USER="Jane Doe"

environment variables are variables that can be used across commands and programs and hold information about the environment.

  1. The line USER="Jane Doe" sets the environment variable USER to a name "Jane Doe". Usually the USER variable is set to the name of the computer's owner.
  2. The line export makes the variable to be available to all child sessions initiated from the session you are in. This is a way to make the variable persist across programs.
  3. At the command line, the command echo $USER returns the value of the variable. Note that $ is always used when returning a variable's value. Here, the command echo $USER returns the name set for the variable.
Report a Bug
If you see a bug or any other issue with this page, please report it here.