What does “export” do?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







4















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.










share|improve this question































    4















    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.










    share|improve this question



























      4












      4








      4


      2






      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.










      share|improve this question
















      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.







      environment-variables






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 30 '14 at 9:06









      Flyk

      1,38931624




      1,38931624










      asked Jul 20 '12 at 3:48









      ShenShen

      13327




      13327






















          2 Answers
          2






          active

          oldest

          votes


















          5














          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).






          share|improve this answer

































            2














            "Exporting" a variable in the shell makes it available to all subshells and processes created by that shell.



            It does not make it available everywhere in the system, only by processes created from that shell.



            Here is an example you can try to prove the point.



            ("set" will list all the variables set in the terminal)



               $ ZZZ=test
            $ bash # this runs bash in bash, you can also type 'xterm' to see it work there too.
            $ set |grep ZZZ # You will not see ZZZ=test
            $ exit # Lets get out of the subshell and try export!
            $ export ZZZ
            $ bash
            $ set |grep ZZZ # and there we go! our variable is set in the subshell/process.


            You can open another terminal, and see that it is not set there, however.



            http://ss64.com/bash/export.html






            share|improve this answer
























            • Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.

              – Shen
              Jul 20 '12 at 5:49










            protected by Sergiy Kolodyazhnyy Feb 12 at 11:04



            Thank you for your interest in this question.
            Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



            Would you like to answer one of these unanswered questions instead?














            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            5














            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).






            share|improve this answer






























              5














              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).






              share|improve this answer




























                5












                5








                5







                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).






                share|improve this 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).







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jul 20 '12 at 5:34

























                answered Jul 20 '12 at 4:10









                JazzJazz

                1,79631934




                1,79631934

























                    2














                    "Exporting" a variable in the shell makes it available to all subshells and processes created by that shell.



                    It does not make it available everywhere in the system, only by processes created from that shell.



                    Here is an example you can try to prove the point.



                    ("set" will list all the variables set in the terminal)



                       $ ZZZ=test
                    $ bash # this runs bash in bash, you can also type 'xterm' to see it work there too.
                    $ set |grep ZZZ # You will not see ZZZ=test
                    $ exit # Lets get out of the subshell and try export!
                    $ export ZZZ
                    $ bash
                    $ set |grep ZZZ # and there we go! our variable is set in the subshell/process.


                    You can open another terminal, and see that it is not set there, however.



                    http://ss64.com/bash/export.html






                    share|improve this answer
























                    • Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.

                      – Shen
                      Jul 20 '12 at 5:49
















                    2














                    "Exporting" a variable in the shell makes it available to all subshells and processes created by that shell.



                    It does not make it available everywhere in the system, only by processes created from that shell.



                    Here is an example you can try to prove the point.



                    ("set" will list all the variables set in the terminal)



                       $ ZZZ=test
                    $ bash # this runs bash in bash, you can also type 'xterm' to see it work there too.
                    $ set |grep ZZZ # You will not see ZZZ=test
                    $ exit # Lets get out of the subshell and try export!
                    $ export ZZZ
                    $ bash
                    $ set |grep ZZZ # and there we go! our variable is set in the subshell/process.


                    You can open another terminal, and see that it is not set there, however.



                    http://ss64.com/bash/export.html






                    share|improve this answer
























                    • Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.

                      – Shen
                      Jul 20 '12 at 5:49














                    2












                    2








                    2







                    "Exporting" a variable in the shell makes it available to all subshells and processes created by that shell.



                    It does not make it available everywhere in the system, only by processes created from that shell.



                    Here is an example you can try to prove the point.



                    ("set" will list all the variables set in the terminal)



                       $ ZZZ=test
                    $ bash # this runs bash in bash, you can also type 'xterm' to see it work there too.
                    $ set |grep ZZZ # You will not see ZZZ=test
                    $ exit # Lets get out of the subshell and try export!
                    $ export ZZZ
                    $ bash
                    $ set |grep ZZZ # and there we go! our variable is set in the subshell/process.


                    You can open another terminal, and see that it is not set there, however.



                    http://ss64.com/bash/export.html






                    share|improve this answer













                    "Exporting" a variable in the shell makes it available to all subshells and processes created by that shell.



                    It does not make it available everywhere in the system, only by processes created from that shell.



                    Here is an example you can try to prove the point.



                    ("set" will list all the variables set in the terminal)



                       $ ZZZ=test
                    $ bash # this runs bash in bash, you can also type 'xterm' to see it work there too.
                    $ set |grep ZZZ # You will not see ZZZ=test
                    $ exit # Lets get out of the subshell and try export!
                    $ export ZZZ
                    $ bash
                    $ set |grep ZZZ # and there we go! our variable is set in the subshell/process.


                    You can open another terminal, and see that it is not set there, however.



                    http://ss64.com/bash/export.html







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jul 20 '12 at 5:20









                    JamezQ JamezQ

                    511




                    511













                    • Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.

                      – Shen
                      Jul 20 '12 at 5:49



















                    • Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.

                      – Shen
                      Jul 20 '12 at 5:49

















                    Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.

                    – Shen
                    Jul 20 '12 at 5:49





                    Thanks for your explanation and especially the example. I gave best answer to the other guy because he came a little earlier.

                    – Shen
                    Jul 20 '12 at 5:49





                    protected by Sergiy Kolodyazhnyy Feb 12 at 11:04



                    Thank you for your interest in this question.
                    Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                    Would you like to answer one of these unanswered questions instead?



                    Popular posts from this blog

                    How to change which sound is reproduced for terminal bell?

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?