问题原文
原帖链接 · v78 · CC BY-SA 3.0
I am trying to source my .bashrc file on remote host inside sudo-less user. I am getting following responses.
sh-4.2$ source .bash_profile
sh-4.2$ source: .bash_profile: file not found
sh-4.2$ source ~/.bash_profile
[user@hera ~]$
Why is this behavior?
contents of .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
# added by Anaconda3 4.1.1 installer
export PATH="/home/tensorflow/anaconda3/bin:$PATH"
已采纳解答
原帖链接 · DerfK · CC BY-SA 3.0
You are using bash in POSIX mode.
From man bash under source filename [arguments]
If filename does not contain a slash, file names in PATH are used to find the directory containing filename... When bash is not in posix mode, the current directory is searched if no file is found in PATH.
Bash is running in posix mode because you have started it as sh rather than bash (thus the command prompt being sh-4.2). You will need to change your shell to /bin/bash in order to use "bash-isms" like this.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
