linux - 如何在 bash_profile 文件中添加导出语句?

标签 linux bash

我正在尝试了解是否必须添加导出语句以在 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/

相关文章:

linux - qt打印到终端

Bash - 基于以毫秒为单位的时间戳搜索

实时日志文件上的 bash tail,计算具有相同日期/时间的 uniq 行

bash - Dockerfile CMD用于从主机获取bash命令

linux - 如何禁用 GNOME 桌面屏幕锁定?

linux - 以非 root 用户身份运行 Nginx

linux - Linux下判断设备是否为触摸屏设备

bash - 如何生成不带某些字符或允许某些字符集的 openssl 河豚

linux - 从 10000 个文件中并行搜索特定字符串模式

linux - 将目录挂载到 docker 容器