【问题标题】:Command not found when running a local executable from csh script从 csh 脚本运行本地可执行文件时找不到命令
【发布时间】:2013-10-03 01:10:40
【问题描述】:

我当前的项目涉及使用在 80 年代中期在 Fortran 77 上编写的 .go 可执行文件。我目前对它的唯一访问是通过 ssh 到使用 csh 的服务器。我编写了以下脚本:

set inpdir = $argv[1]
mkdir ${inpdir}"_out"
set j = 1
while ($j <= 5)
    set i = 0
    while ($i <= 20)
        "tms96-fnl.go <./"${inpdir}"/inp"${j}"0"${i}".d> ./"${inpdir}"_out/out"${j}"0"${i}
        set i = i + 1
    end
    set j = j + 1
end

结果是消息:

tms96-fnl.go <./fftf/inp100.d> ./fftf_out/out100 -Command not found
Syntax error

如果我要键入该消息的内容(没有“-Command not found”),同时它与按预期执行的脚本位于同一工作目录中。

【问题讨论】:

  • 这正是您正在运行的脚本吗?它是如何在错误消息中显示的输入文件名末尾生成.d 的?
  • 你说得对,对不起。我不得不手动输入它,因为我使用的服务器被锁得很紧,我不能 scp。以上编辑。
  • 我认为问题可能出在引号的排列上。你有"tms96-fnl.go &lt;./"${inpdir}"/inp"${j}"0"${i}".d&gt; ./"${inpdir}"_out/out"${j}"0"${i},它可能被解释为一个看起来像"tms96-fnl.go &lt;./"的命令。我会尝试:tms96-fnl.go &lt; ./"${inpdir}"/inp"${j}"0"${i}".d &gt; ./${inpdir}"_out/out"${j}"0"${i}"
  • 这解决了我的问题。非常感谢!

标签: shell executable csh


【解决方案1】:

问题在于引号的排列。你有:

"tms96-fnl.go <./"${inpdir}"/inp"${j}"0"${i}".d> ./"${inpdir}"_out/out"${j}"0"${i}

这将解释一个看起来像 tms96-fnl.go &lt;./ 的命令。我会这样做:

tms96-fnl.go < ./"${inpdir}"/inp"${j}"0"${i}".d > ./"${inpdir}"_out/out"${j}"0"${i}"

【讨论】:

    猜你喜欢
    • 2010-11-29
    • 2014-03-18
    • 1970-01-01
    • 2014-01-05
    • 2017-06-17
    • 2017-12-07
    • 2017-06-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多