linux - bash_profile 中的更改未反射(reflect)在 linux 中

标签 linux macos bash shell

<分区>

下面是我编辑的.bash_profile 文件。当我使用 echo $JAVA_HOMEecho $PATH 时,我在这里所做的更改没有得到反射(reflect)。

当我使用 $PATH 时,我得到 /usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin在任何 .bash_profile.bash_rc 中都找不到。

如何让我的 .bash_profile 工作?

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

export PATH=/sbin/:$PATH

export PATH=$PATH:$HOME/bin

export JAVA_HOME=/export/home/lg199447/dev/jdk1.7.0_51/bin/java

export PATH=$PATH:/export/home/lg199447/dev/jdk1.7.0_51/bin

注意: 我正在尝试使用 ssh 从 OS X 终端登录服务器,登录后我的终端显示 $ 后跟我的光标。我无法使用我的箭头键和标签。所以我通过在 /bin 目录中执行 bash 来手动启动 bash。这将我的终端更改为 lg199447@VDCALD564/]$,我能够以在 mac 中使用的正常方式使用终端。

最佳答案

这听起来像你在 linux 机器上登录 shell 不是 bash , 但一些其他的 shell 变体。 ~/.bash_profile仅用于 bash 登录 shell,因此如果您只执行 bash , 它不是。

要么制作/bin/bash您的登录 shell(使用命令 chsh -s /bin/bash ),或使用 bash -l 启动 bash ,那么它应该可以工作。

另一种选择是将您的启动代码放在 ~/.bashrc 中,这是为所有交互式 bash session 提供的(除非使用 --norc 选项明确禁用)。

关于linux - bash_profile 中的更改未反射(reflect)在 linux 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22821979/

相关文章:

linux - 使用多选项解释 rsa 的 openssl 速度输出

c - 回显值到 Linux 控制台

php - 在哪里存储 cronjobs 的脚本文件?

java - 下载java文件后打不开

xcode - MacOS Catalina "Developer Tools"选项卡已隐藏

macos - ld : library not found for -lssl/clang: error: linker command failed with exit code 1 (use -v to see invocation)

linux - #define SYSCALL_DEFINEx(x, sname, ...)

bash - 在bash脚本: how to signal to the (human) user that an error triggered a premature exit?中

Bash:多重模式匹配

bash - 如何在bash中随机数的上限重复一个函数