我正在尝试了解是否必须添加导出语句以在 bash_profile 文件中设置变量。我该怎么做?例如,如果我必须添加 export AX = 'name' 那么我应该简单地将它写在文件末尾还是我还需要写任何其他内容
最佳答案
只需在 ~/.bash_profile
文件中的任意位置写入 export AS='name'
:
# Append to the end of the file
$ echo "export AS='name'" >> ~/.bash_profile
# Update shell
$ source ~/.bash_profile
第一个命令将您想要的行添加到文件(或只使用文本编辑器),第二个命令使用新变量更新 shell。
关于linux - 如何在 bash_profile 文件中添加导出语句?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14524590/