When different shells are encountered, it takes precedence over shellrc(.bashrc, .zshrc)
Signed-off-by: Hu XueJiao 1034502035@qq.com --- lib/env.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/lib/env.sh b/lib/env.sh index a8d3c0ff..78cfd6f5 100755 --- a/lib/env.sh +++ b/lib/env.sh @@ -121,9 +121,7 @@ is_system()
shell_profile() { - if [ "${SHELL##*/}" == "bash" ]; then - echo $HOME/.${SHELL##*/}_profile - else - echo $HOME/.${SHELL##*/}rc - fi + local profile="$HOME/.${SHELL##*/}rc" + [ -f "$profile" ] || profile="$HOME/.${SHELL##*/}_profile" + echo $profile }