[问题] 为什么我的批处理命令不能 运行

sh/bash/dash/ksh/zsh等Shell脚本
回复
wutflash
帖子: 10
注册时间: 2007-12-12 9:42

[问题] 为什么我的批处理命令不能 运行

#1

帖子 wutflash » 2008-04-30 16:24

我编写了一个批处理命令的程序,想先 执行文件夹a中的程序ddscat,然后是文件夹b中的程序ddscat,文件夹c中的程序ddscat. 具体如下:

#!/bin/bash
~/Desktop/a/ddscat
~/Desktop/b/ddscat
~/Desktop/c/ddscat

程序文件名为first1。

然后输入: chmod +x first1 和 ./first1

可输出结果却为:./first1: line 2: ddscat:找不到命令

请大家帮帮忙,看看程序到底哪里出错了,正确的应该怎么编,谢谢。。。

注:ddscat是fortran 编译后的执行程序
头像
xiooli
帖子: 6956
注册时间: 2007-11-19 21:51
来自: 成都
联系:

#2

帖子 xiooli » 2008-04-30 16:28

ddscat程序没有可执行权限吧
wutflash
帖子: 10
注册时间: 2007-12-12 9:42

#3

帖子 wutflash » 2008-04-30 16:43

这么说ddscat就不能用批处理 命令来执行了吗,还是需要重新制定一个权限呢。。。
头像
xiooli
帖子: 6956
注册时间: 2007-11-19 21:51
来自: 成都
联系:

#4

帖子 xiooli » 2008-04-30 16:47

对ddscat也进行一下chmod +x应该就行了。
wutflash
帖子: 10
注册时间: 2007-12-12 9:42

#5

帖子 wutflash » 2008-04-30 16:58

我试过了,chmod +x ddscat

可还是:./first1: line 2: ddscat:找不到命令

真是要疯了............
头像
xiooli
帖子: 6956
注册时间: 2007-11-19 21:51
来自: 成都
联系:

#6

帖子 xiooli » 2008-04-30 17:09

那你直接运行ddscat能不能成功啊?还有就是脚本里面使用绝对路径试试。
wutflash
帖子: 10
注册时间: 2007-12-12 9:42

#7

帖子 wutflash » 2008-05-04 16:42

我用perl编写了一个程序,已经搞定了,谢谢阿。。。。
回复