Quick Answer: How Do I Export an Environment Variable in Linux?
Contents

To export a environment variable you run the export command while setting the variable. We can view a complete list of exported environment variables by running the export command without any arguments. To view all exported variables in the current shell you use the -p flag with export.

How do I export a variable in Linux?

Export Variables

  1. vech=Bus. Display the value of a variable with echo, enter:
  2. echo “$vech” Now, start a new shell instance, enter:
  3. bash. Now, display back the value of a variable vech with echo, enter:
  4. echo $vech. …
  5. export backup=”/nas10/mysql” echo “Backup dir $backup” bash echo “Backup dir $backup” …
  6. export -p.

How do I export an environment variable in terminal?

Inside the Command Prompt execute the following command:

  1. echo %TWILIO_ACCOUNT_SID% This should print the value that you saved in the environment variable. …
  2. echo $SHELL. …
  3. export KEY=value. …
  4. export TWILIO_ACCOUNT_SID=youraccountsid. …
  5. echo $TWILIO_ACCOUNT_SID. …
  6. TWILIO_ACCOUNT_SID=youraccountsid.
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest