保存后退出,source ~/.bash_profile,执行生效的指令 由于我每次关闭窗口后,都要重新执行source 才能重新生效,固将路径添加到了~/.zshrc文件里解决了。 据了解,计算机每次都会默认执行~/.zshrc 文件,所以添加到这里保证肯定会执行,也可在~/.zshrc文件里加一句 source ~/.bash_profile。 “
# 设置默认提示符 export PS1="%n@%m %c %~ $ " # 设置别名 alias ll='ls -al' alias la='ls -A' # 加载插件 plugins=(git) # 加载 Oh My Zsh source /usr/local/share/oh-my-zsh/oh-my-zsh.sh 3..bash_profile 作用: .bash_profile是 Bash shell 的用户级配置文件。 它在每次用户登录...
后,~/.bash_profile并没有被执行,所以需要编辑 zsh 的配置文件~/.zshrc,在该文件里加入 source ~/.bash_profile 现在我们应该可以用命令了。
.bash_profile 文件中所修改的环境变量,只会对当前窗口起效,还要手动 source ~/.bash_profile 之后才能使用; .zshrc 文件则像是开机启动的配置文件,在电脑启动后生效。 所以,我们可以在 .zshrc 文件中,添加一句 source $HOME/.bash_profile 即可解决原来需要手动 source 才能使用的问题。
~/.bash_profile ~/.bash_profile 文件是针对 Bash shell 的配置文件。当 Bash shell 以 login 方式执行时,它会读取 ~/.bash_profile 文件。如果该文件不存在,它会尝试读取 ~/.bash_login 文件。如果两者都不存在,它则会读取 ~/.profile 文件。也就是说,当你作为登录用户使用 Bash shell 的时候,这个文件...
在终端操作中,.bash_profile和.zshrc是用于配置Bash和Zsh shell环境的关键文件。Bash shell以login方式运行时,会读取.bash_profile文件,而文件不存在时,会尝试读取.bash_login或.profile文件。这意味着,.bash_profile在用户登录时初始化Bash shell环境设置。相比之下,.zshrc文件针对Zsh shell,无论...
我自己在.bash_profile中存了一些环境变量,比如 export PAAAATH = 'xxx' 然后每次新开item2窗口,都需要执行source ~/.bash_profile里面的PAAAATH才会生效。 网上说把source ~/.bash_profile放到.zshrc的最下面,于是我修改 # nvm config export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \....
.bash_profile和.zshrc .bash_profile和.zshrc 说说配置环境变量的⽅法:vim ~/.bash_profile 进⼊配置⽂件 添加路径例如:PATH=$PATH:\ /Users/linyue/mywork/script:\ 保存后退出,source ~/.bash_profile,执⾏⽣效的指令 由于我每次关闭窗⼝后,都要重新执⾏source 才能重新⽣效,固将路径...
2、输入 touch .bash_profile (如果该文件不存在,将创建一个空文件) 3、输入 open .bash_profile ...
如果你使用的是 bash shell,配置文件通常是 .bashrc 或.bash_profile。 如果你使用的是 zsh shell,配置文件通常是 .zshrc。 使用文本编辑器打开所选的配置文件: 你可以使用多种文本编辑器来编辑配置文件,例如 nano、vim、emacs 等。 以下是一些使用不同编辑器打开配置文件的示例命令: 使用nano 编辑器:nano ~...