'source .bash_profile' 不起作用但是 'source path / to / .bash_profile' 在职的

我正在尝试创建自己的文件 .bashrc 在用户内的远程主机上 sudo-less. 我得到了以下答案。

sh-4.2$ source .bash_profile
sh-4.2$ source: .bash_profile: file not found

sh-4.2$ source ~/.bash_profile
[user@hera ~]$

为什么这是行为?

https://i.stack.imgur.com/vO0yq.png
https://i.stack.imgur.com/58q1m.png
内容 .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"
已邀请:

卫东

赞同来自:

你正在使用 bash 在模式 POSIX.



man bash

在下面

source filename [arguments]

如果文件名不包含斜角,则文件名 PATH 用于搜索包含文件名的目录 ... 什么时候 bash 不是在模式中 posix, 如果在当前目录中执行搜索 PATH 提交文件。

Bash 在模式下工作 posix, 因为你推出它

sh

比较可能

bash

(所以命令行

sh-4.2

). 您需要更改shell

/bin/bash

使用这种“bashmet”。

郭文康

赞同来自:

您可以在命令的帮助下查看哪条路径 pwd - 我打赌你的 .bashrc 不在当前的工作目录中

要回复问题请先登录注册