Ubuntu – What does “export” do

environment-variables

I never understand what "export" does. For example, what's the difference between these two?

  1. PYTHONPATH=/home/myaccount/ & export PYTHONPATH and
  2. PYTHONPATH=/home/myaccount/

One with export and the other without.

Best Answer

If you don't export, then the environment variable will only be visible locally. Exporting makes them available to other programs and shells you might launch (from that shell).