在.bashrc文件的末尾,我添加了以下几行以设置主目录中foo文件夹的路径:

PATH = $PATH:/home/username/foo
export PATH;

然后我输入bash:
source .bashrc

这些产生的错误:
bash: PATH: command not found

我正在使用Debian Squeeze。在类似的问题here中,建议修改/etc/login.defs。我不想这样做,就像在login.defs中这样写:
add the rest [of your paths] in the shell startup files

如何将文件夹foo添加到.bashrc中的PATH?

最佳答案

您使用了错误的语法。删除空格:

export PATH=$PATH:/home/username/foo

关于/etc/login.defs或任何其他全局配置:嗯,这是全局配置,因此在$HOME目录中添加路径可能不是一个好主意。 ;)

09-30 21:04
查看更多