How to add export statement in a bash_profile file?

前端 未结 3 1384
刺人心
刺人心 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:46

    Simply write export AS='name' anywhere in your ~/.bash_profile file:

    # Append to the end of the file
    $ echo "export AS='name'" >> ~/.bash_profile
    
    # Update shell 
    $ source ~/.bash_profile
    

    This first command adds the line you want to the file (or just use a text editor) the second updates the shells with the new variable.

提交回复
热议问题