shell> export HISTTIMEFORMAT='%F %T '
shell> history | tail -n 2
1006 2010-01-16 00:55:47 export HISTTIMEFORMAT='%F %T '
1007 2010-01-16 00:55:49 history | tail -n 2
只要设置了环境变量,这就会持续下去,因此如果我注销,您将需要再次设置它。我如何使这个永久?
最佳答案
将其添加到您的 ~/.bashrc
和 ~/.bash_profile
- bash 启动时将读取其中之一。 .bash_profile
登录时读取,.bashrc
在创建新的交互式非登录 shell 时读取(例如从 X 打开终端窗口)
关于shell - 使环境变量永久化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5388054/