赞助连接

赞助连接

阅 读 文 章

[已解决] shell 不能执行

[来源:网上转载 (http://bbs.chinaunix.net) | 作者:网友(网络转载) | 时间:2008-08-08 | 浏览:人次 ]

a.sh 的内容如下:

[root@ ~]# more a.sh
#!/bin/sh

echo "twst";

[root@ ~]# chmod +x a.sh
[root@ ~]# ./a.sh
./a.sh: Command not found.

这是为什么啊,系统版本是FreeBSD6.2






QUOTE:原帖由 chinaunixzcx 于 2008-8-5 17:41 发表
a.sh 的内容如下:

[root@ ~]# more a.sh
#!/bin/sh

echo "twst";

[root@ ~]# chmod +x a.sh
[root@ ~]# ./a.sh
./a.sh: Command not found.

这是为什么啊,系统版本是FreeBSD6.2
这应该是和   #!/bin/sh 这个有关

你 whereis sh 看一下 sh 的路径

或改成 #!/bin/csh


看样子像是连a.sh本身都没有找到,用绝对路径试试。




QUOTE:原帖由 chinaunixzcx 于 2008-8-5 17:41 发表
a.sh 的内容如下:

[root@ ~]# more a.sh
#!/bin/sh

echo "twst";

[root@ ~]# chmod +x a.sh
[root@ ~]# ./a.sh
./a.sh: Command not found.

这是为什么啊,系统版本是FreeBSD6.2
改成 chmod u+x a.sh,试试!


谢谢各位,问题找到了,原因是脚本每一行后面多了一个 ^M 这是一个隐藏字符,我是在windows下编辑好了之后传过去的,所以才会出现这样的问题,用vi 将 ^M 删除就ok了,




QUOTE:原帖由 chinaunixzcx 于 2008-8-6 09:10 发表
谢谢各位,问题找到了,原因是脚本每一行后面多了一个 ^M 这是一个隐藏字符,我是在windows下编辑好了之后传过去的,所以才会出现这样的问题,用vi 将 ^M 删除就ok了,
既装瑜,何用亮。


TAG标签 : 执行 不能 解决 a.sh root@ 这是 问题 chmod /bin/sh

最新评论 共有0位网友发表了评论

发表评论

评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名:(注册)
密码:
验证码:
匿名发表
网站地图友情连接交流论坛网站投稿广告服务联系我们留言本站长统计
Some rights reserved: www.chmhome.com, 鄂ICP备07010232号 E-mail:chinakafei@live.com,QQ:552766
中国咖啡技术网(Chmhome):国外编程技术书籍,中文编程手册,经典编程文章,交流技术,技术软件下载,计算机论文,毕业论文.