本文介绍了使环境变量永久化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

只要环境变量被设置,这将持续,所以如果我注销你将需要重新设置。如何使这个永久性?

This will last as long as environment variable is set, so if I log out you will need to set it again. How do I make this permanent?

推荐答案

将其添加到您的〜/ .bashrc 〜/ .bash_profile - 当bash启动时,其中一个将被读取。当您登录时, .bash_profile 被读取,当您创建一个新的交互式非登录shell时,读取 .bashrc 作为从X打开一个终端窗口)

Add it to your ~/.bashrc and ~/.bash_profile - one of these will be read when bash starts. .bash_profile is read when you login, .bashrc is read when you create a new interactive non-login shell (such as opening a terminal window from X)

这篇关于使环境变量永久化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 04:48