[英]Julia and Bash - Julia's shell mode doesn't execute ~/.bash_profile (or ~/.bashrc)
In all current versions of Julia, shell mode, when you type ";" 在Julia的所有当前版本中,当您键入“;”时,在shell模式下 in julia console, doesn't execute any of the code placed in my ~/.bash_profile, whereas my normal bash terminal does execute them.
在julia控制台中,不会执行〜/ .bash_profile中放置的任何代码,而我的普通bash终端会执行它们。
If possible, how can I make the shell mode of Julia execute parts of my .bash_profile file, if not, will it be available in future Julia versions ? 如果可能,如何使Julia的shell模式执行我的.bash_profile文件的一部分,如果没有,它将在将来的Julia版本中可用吗?
I run my bash terminal in MacOS Mojave and here is a sample of code I have in my bash_profile : 我在MacOS Mojave中运行bash终端,这是bash_profile中包含的代码示例:
alias ls='ls -GFh'
function d() {
cd "$@"
ls
}
So I can use "d" in my normal terminal but I can't use it in shell mode in Julia. 因此,我可以在普通终端中使用“ d”,但不能在Julia的shell模式下使用它。
.bash_profile
is only ready when bash is started as a login shell (eg using --login
CLI option). .bash_profile
仅在将bash作为登录shell启动(例如,使用--login
CLI选项)时才准备就绪。 Apparently Julia starts bash as a normal (non-login) shell, in which case bash will only read .bashrc
file. 显然,Julia将bash作为普通(非登录)shell启动,在这种情况下,bash仅读取
.bashrc
文件。
To keep things relatively simple, you should probably move the code you want to always be executed into .bashrc
, and then source .bashrc
from .bash_profile
like this: 为了使事情相对简单,您可能应该将要始终执行的代码移到
.bashrc
,然后从.bash_profile
.bashrc
,如下所示:
[ -r ~/.bashrc ] && source ~/.bashrc
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.