Why do I need to source bash_profile every time

后端 未结 6 1354
[愿得一人]
[愿得一人] 2021-02-04 01:28

I have installed Hadoop and every time I want to run it, first I have to do this:

source ~/.bash_profile

or it won\'t recognize the command

6条回答
  •  走了就别回头了
    2021-02-04 02:11

    Now that we've narrowed down the problem:

    1. Run ps -p $$ at the command line to determine that you are, in fact, using a bash shell.
    2. Realize that you are in zsh, which means you should be editing your profile in .zshrc.
    3. Copy the offending lines from .bash_profile to .zsh, OR
    4. Modify your .zshrc to directly source your .bash_profile.

    UPDATE: Do what @TC1 mentions in the comments and keep the shell-specific code in each shell's own profile, and from those profiles, only source shell-agnostic code.

提交回复
热议问题