Defining a variable with or without export

后端 未结 14 1484
借酒劲吻你
借酒劲吻你 2020-11-22 09:58

What is export for?

What is the difference between:

export name=value

and

name=value
相关标签:
14条回答
  • 2020-11-22 10:59

    To illustrate what the other answers are saying:

    $ foo="Hello, World"
    $ echo $foo
    Hello, World
    $ bar="Goodbye"
    $ export foo
    $ bash
    bash-3.2$ echo $foo
    Hello, World
    bash-3.2$ echo $bar
    
    bash-3.2$ 
    
    0 讨论(0)
  • 2020-11-22 11:00

    export will make the variable available to all shells forked from the current shell.

    0 讨论(0)
提交回复
热议问题