Chinaunix

标题: command not found. [打印本页]

作者: welyngj    时间: 2004-02-27 23:45
标题: command not found.
我建立了一个test.sh文件,我这样 ! test.sh
为什么 系统却说command not found.
作者: bjgirl    时间: 2004-02-27 23:54
标题: command not found.
chmod +x test.sh
作者: welyngj    时间: 2004-02-28 00:02
标题: command not found.
谢谢回复,但是还是没有用,我用的是bash.
作者: andm    时间: 2004-02-28 03:02
标题: command not found.
chown owner file
作者: slimzhao    时间: 2004-02-28 05:26
标题: command not found.
. test.sh
source test.sh
sh test.sh
bash test.sh
chmod a+x test.sh; ./test.sh
但!test.sh
的意思是说在命令历史列表里查找最近使用过的以test.sh开头的那个命令, 然后执行它, 因为你的test.sh尚未被执行过一次, 所以报告说
命令没找到。意思是说在命令历史列表里还没有匹配的命令
作者: welyngj    时间: 2004-02-28 08:22
标题: command not found.
那我要执行一个 test.sh
文件怎么执行呀!
作者: welyngj    时间: 2004-02-28 13:17
标题: command not found.
我知道了bash test.sh.
作者: bjgirl    时间: 2004-02-28 14:12
标题: command not found.
原帖由 "welyngj" 发表:
那我要执行一个 test.sh
文件怎么执行呀!
. test.sh
source test.sh
sh test.sh
bash test.sh
chmod a+x test.sh; ./test.sh
那么多方法你任选其一喔
作者: ccf    时间: 2004-02-28 14:50
标题: command not found.
楼上的各位都对,但既然是“command not found”当然是路径不对了,所以可不可以用
./test.sh或者完整路径了
作者: wooyifan    时间: 2010-12-01 10:53
请问这个文件(test.sh)您是在什么环境下编写的呢(我的意思是UNIX还是Windows)?如果这个文件您是在Windows下编写然后再拷贝到unix下的话,是肯定运行不了的,需要格式转换!步骤如下:
1)打开该文件 vim test.sh
2):set fileformat=unix
3):write
4):wq
5)./test.sh
作者: shenzc1134    时间: 2010-12-01 12:46
回复 10# wooyifan


    不会所有的都要转换吧?我在我的环境上使用,好像直接加上权限就可以执行的呢?是不是系统哪里可以定义呢?
作者: 吕行军    时间: 2011-07-14 16:51
我遇到一种此种报错的情况,确如10楼所说的那种场景。我使用的是UE编辑的一个脚本,ftp到Linux服务器上后,脚本实现了想要的结果,但是就是在屏幕上报错“:Command not found”。在服务器上使用vi重新编辑一个脚本后,就不报错了。
属于格式的问题




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2