How to add export statement in a bash_profile file?

前端 未结 3 1383
刺人心
刺人心 2021-02-07 02:23

I\'m trying to learn that if I have to add export statement to set a variable in a bash_profile file . How would I do that ? For example if I have to add export AX = \'name\' t

3条回答
  •  醉话见心
    2021-02-07 02:58

    There are 2 scenarios:

    1. Exporting an independent variable

    For example if you want to export variable "AX" independently then use:

    AX = 'name'
    export AX
    

    2. Exporting an independent variable followed by appending it to some existing variable

    For example if you want to export variable "AX" independently followed by appending it to the class path then use:

    AX = 'name'
    export AX
    PATH=$PATH:AX
    export PATH
    

提交回复
热议问题