Julia和Bash - Julia的shell模式不执行〜/ .bash_profile(或〜/ .bashrc)

问题描述 投票:1回答:1

在所有当前版本的Julia,shell模式中,当您键入“;”时在julia控制台中,不会执行放在〜/ .bash_profile中的任何代码,而我的普通bash终端会执行它们。

如果可能,如何让Julia的shell模式执行我的.bash_profile文件的部分,如果没有,它将在未来的Julia版本中可用吗?

我在MacOS Mojave中运行我的bash终端,这是我在bash_profile中的代码示例:

alias ls='ls -GFh'
function d() {
    cd "$@"
    ls
}

所以我可以在我的普通终端中使用“d”,但我不能在Julia的shell模式下使用它。

bash shell console julia
1个回答
2
投票

.bash_profile仅在bash作为登录shell启动时才准备好(例如,使用--login CLI选项)。显然Julia将bash作为普通(非登录)shell启动,在这种情况下,bash只会读取.bashrc文件。

为了保持相对简单,你应该将你想要执行的代码移动到.bashrc,然后从.bashrc中获取.bash_profile,如下所示:

[ -r ~/.bashrc ] && source ~/.bashrc
© www.soinside.com 2019 - 2024. All rights reserved.