[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了,
既装瑜,何用亮。
会员注册
会员登录
个人空间