linux cshrc文件,linux-在.cshrc中设置PATH无效

在我的.cshrc中,有两行:

setenv PATH /a/bin:$PATH

cd /a/

的结果

setenv

是

...

PATH=/a/bin:

...

的结果

ls -l /a/bin

是

-rwxr-x--x 1 evgeny evgeny 122 May 13 13:43 run_me

的结果

run_me

是

run_me: Command not found.

如何解决?

解决方法:

因为tcsh或csh使用不同的语法作为bash.您确定要使用类似csh的shell吗?对于类似sh的shell(例如bash),您需要将命令添加到.profile中.

在您的.cshrc中尝试下一个:

set path=(/a/bin $path)

并重新记录或使用

source .cshrc #for re-read the cshrc

rehash #reread avialable commands in the path

编辑-测试结果

[me@orion]/home/me(135)> echo $0

-tcsh

[me@orion]/home/me(136)> mkdir a

[me@orion]/home/me(137)> cd a

[me@orion]/home/me/a(138)> echo echo "$0 here" >run_me

[me@orion]/home/me/a(139)> chmod 755 run_me

[me@orion]/home/me/a(140)> cd

[me@orion]/home/me(141)> set path=($HOME/a $path)

[me@orion]/home/me(142)> rehash

[me@orion]/home/me(143)> run_me

/home/me/a/run_me here

标签:csh,shell,linux

在我的.cshrc中,有两行: setenv PATH /a/bin:$PATH cd /a/ 的结果 setenv 是 ... PATH=/a/bin: ... 的结果 ls -l /a/bin 是 -rwxr-x--x 1 evgeny evgeny 122 May 13 13:43 run_me 的结果 run_me 是 run_me: Command not found. 如何解决? 解决方法: 因为tcsh或csh使用不同的语法作为bash.您确定要使用类似csh的shell吗?对于类似sh的shell(例如bash),您需要将命令添加到.profile中. 在您的.cshrc中尝试下一个: set path=(/a/bin $path) 并重新记录或使用 source .cshrc #for re-read the cshrc rehash #reread avialable commands in the path 编辑-测试结果 [me@orion]/home/me(135)> echo $0 -tcsh [me@orion]/home/me(136)> mkdir a [me@orion]/home/me(137)> cd a [me@orion]/home/me/a(138)> echo echo "$0 here" >run_me [me@orion]/home/me/a(139)> chmod 755 run_me [me@orion]/home/me/a(140)> cd [me@orion]/home/me(141)> set path=($HOME/a $path) [me@orion]/home/me(142)> rehash [me@orion]/home/me(143)> run_me /home/me/a/run_me here 标签:csh,shell,linux
经验分享 程序员 微信小程序 职场和发展