打开终端并运行Shell脚本(CentOS)后出现Bash错误 [英] Bash error after opening Terminal and running shell scripts (CentOS)

查看:371
本文介绍了打开终端并运行Shell脚本(CentOS)后出现Bash错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我在CentOS 6.4中打开终端时,都会出现错误:

  bash:usr / local / bin:否这样的文件或目录

我检查了.bashrc和.bash_profile来查看是否有任何行参考usr / local / bin,但未找到任何内容。当我切换到root或运行shell脚本时,也会出现相同的错误。



就像在usr前面添加反斜线一样简单吗?像这样-

  / usr / local / bin 

虽然还是不知道错误发生在哪里。任何帮助深表感谢。谢谢!

解决方案

这很奇怪,因为centos 6.4系统上的普通bash目录是/ bin / bash,但是我建议您需要检查以下内容:

  echo $ SHELL 

它应该拉出您的SHELL环境变量,以向您显示您正在使用的Shell,通常看起来像这样:



SHELL = / bin / bash



如果不同,例如:



SHELL = usr / local / bin / bash



然后我将检查您的passwd文件,以确保您的用户默认shell指向正确的位置。



用户名:x:601:601 :: / home /用户名: / bin / bash



我也建议您检查您的位置外壳实际上生活了

 其中bash 
/ bin / bash
pre>

并确保所有内容都指向正确的位置。


Every time I open Terminal in CentOS 6.4, I get the error:

bash: usr/local/bin: No such file or directory

I've checked .bashrc and .bash_profile to see if there are any lines that reference usr/local/bin, but haven't found anything. The same error also appears when I switch to root, or run a shell script.

Is it as simple as adding a backslash in front of usr? Like so--

/usr/local/bin

Still don't know where the error is happening though. Any help is much appreciated. Thanks!

解决方案

This is strange as the normal bash directory on a centos 6.4 system is /bin/bash, however I would advise you to check the following:

echo $SHELL

It should pull your SHELL environment variable to show you where what shell you are using, normally it looks like this:

SHELL=/bin/bash

If it's different say for example:

SHELL=usr/local/bin/bash

then I would check your passwd file to make sure your users default shell is pointing to the right place.

username:x:601:601::/home/username:/bin/bash

Also I would suggest check where you shell actually lives

which bash
/bin/bash

And make sure everything is pointing to the correct location.

这篇关于打开终端并运行Shell脚本(CentOS)后出现Bash错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆