我正尝试在sudo-less用户的远程主机上获取我的.bashrc文件。 我正在收到以下回复。
sh-4.2$ source .bash_profile sh-4.2$ source: .bash_profile: file not found sh-4.2$ source ~/.bash_profile [user@hera ~]$
这是为什么?
添加图像
.bash_profile的内容
.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"
你在POSIX模式下使用bash。
从source filename [arguments] man bash source filename [arguments]
如果文件名不包含斜线,则使用PATH中的文件名来查找包含文件名的目录…当bash不处于posix模式时,如果在PATH中找不到文件,则search当前目录。
Bash运行在posix模式,因为你已经开始sh而不是bash (因此命令提示符是sh-4.2 )。 你将需要将你的shell改为/bin/bash ,以便像这样使用“bash-isms”。
你可以看到pwd命令的path – 我敢打赌你的.bashrc不在当前的工作目录中