如何从内部的zsh进入庆典时加载〜/ .bash_profile中? [英] How to load ~/.bash_profile when entering bash from within zsh?
问题描述
我用的bash两年,而只是试图通过自制软件切换到zsh的外壳在我的OS X。我把我的默认(登录)外壳的zsh,我确认它是由看到,当我启动我的终端设置正确,它是在默认情况下使用的zsh外壳。
I've used bash for two years, and just tried to switch to zsh shell on my OS X via homebrew. And I set my default (login) shell to zsh, and I confirmed it's set properly by seeing that when I launch my Terminal, it's zsh shell that is used in default.
然而,当我尝试从zsh的内进入bash shell中,它看起来像不加载〜/ .bash_profile中
,因为我不能使用别名,这是运行我的命令在我的〜/ .bash_profile中
定义如下别名朱莉娅=〜/ juila /朱莉娅
等。此外,提示是不是我的文件中设置,而是返回的bash-3.2 $
。
However, when I try to enter bash shell from within zsh, it looks like not loading ~/.bash_profile
, since I cannot run my command using aliases, which is defined in my ~/.bash_profile
like alias julia="~/juila/julia"
, etc.. Also, the prompt is not what I set in the file and instead return bash-3.2$
.
对于某些原因,当我把我的登录shell打坏,并从bash的内进入zsh的,那么〜/ .zshrc
是否正确装入。
For some reasons, when I set my login shell to bash, and enter zsh from within bash, then ~/.zshrc
is loaded properly.
那么为什么不加载每当我跑庆典
从zsh的范围内?我的〜/ .bash_profile中
是象征性的,以便将它与我的其他电脑同步连接到〜/ Dropbox的/ .bash_profile中
。也许不会引起这个问题?
So why is it not loaded whenever I run bash
from within zsh? My ~/.bash_profile
is symbolic linked to ~/Dropbox/.bash_profile
in order to sync it with my other computers. Maybe does it cause the issue?
推荐答案
这是互动的庆典
读你的〜/ .bash_profile中
如果它是一个登录shell,或者你的〜/ .bashrc中
如果它不是一个登录shell。
An interactive bash
reads your ~/.bash_profile
if it's a login shell, or your ~/.bashrc
if it's not a login shell.
一个典型的的.bash_profile
将包含类似:
A typical .bash_profile
will contain something like:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
所以的.bashrc
可以包含命令通过登录任何或非登录shell执行。
so .bashrc
can contain commands to be executed by either login or non-login shells.
如果您运行的bash -l </ code>而不仅仅是
庆典
,它应该阅读你的 .bash_profile中
。
If you run bash -l
rather than just bash
, it should read your .bash_profile
.
参考:<一href=\"https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html\">https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html
这篇关于如何从内部的zsh进入庆典时加载〜/ .bash_profile中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!