shaosks

  在用户目录下的.bash_profile文件中增加变量
  用vi在用户目录下的.bash_profile文件中增加变量,改变量仅会对当前用户有效,并且是“永久的”。

  vim /root/.bash_profile  

  

  

  

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export CHROMECHROME_HOME=/usr/bin/chromedrive
export PATH=$PATH:$CHROMECHROME/MYSQL_HOME/bin
export MONGO_DB=/usr/local/mongodb
export PATH=$PATH:$MONGO_DB/bin
~                                    

  要让刚才的修改马上生效,需要在用户目录下执行以下代码:

  source /root/.bash_profile

  

  针对所有用户:

  在/etc/profile文件中添加变量
  用vi在文件/etc/profile文件中增加变量,该变量将会对Linux下所有用户有效,并且是“永久的”。

  要让刚才的修改马上生效,需要执行以下代码

  source /etc/profile 

 

分类:

技术点:

相关文章:

  • 2021-07-15
猜你喜欢
  • 2021-11-28
  • 2021-09-29
  • 2021-11-20
  • 2022-02-09
  • 2022-02-09
  • 2022-02-09
相关资源
相似解决方案