美文网首页Linux
Linux_bash_profile无法生效.md

Linux_bash_profile无法生效.md

作者: 儒徒 | 来源:发表于2020-10-27 10:33 被阅读0次

    问题:

    ~/.bash_profile设置了环境变量,且使用了source ~/.bash_profile使得当前窗口的环境变量生效, 但是关闭终端,重启后,环境变量不再生效.

    原因:

    说明当前的shell的不是bash.
    ps: > 使用以下命令查看当前shell


    Snip20201026_178.png

    我们使用的shell是zsh,不会自动加载~/.bash_profile,而是自动加载.zprofile文件。这里可以在.zprofile文件加上这么一段

    if [ -f ~/.bash_profile ]; then
        source ~/.bash_profile
    fi
    
    if要不要都行.
    

    相关文章

      网友评论

        本文标题:Linux_bash_profile无法生效.md

        本文链接:https://www.haomeiwen.com/subject/sxwtvktx.html