【问题标题】:Why does SunOS say it can't execute this KornShell script? [closed]为什么 SunOS 说它不能执行这个 KornShell 脚本? [关闭]
【发布时间】:2012-06-14 11:08:28
【问题描述】:

我在服务器 A 中有一个 KornShell (ksh) 脚本,它将在服务器 B 中运行一个脚本。

    #!/bin/ksh/
    ssh user@server "/path/script.sh"

脚本权限如下:

 -rwxrwxrwx   1 user    dba           75 Jun 11 10:00 script.sh

我检查了 /bin 中是否存在“ksh”及其存在。 (bash 不是)

当我尝试运行脚本时,我得到 ./script.sh: cannot execute

会发生什么?我手动测试了 ssh 命令,它可以工作。

它是一个 SunOS 系统。

【问题讨论】:

  • 尝试删除 ksh 后的斜线
  • 如果 shebang 中有“ksh”,则不是 Bash 脚本。另外,不要永远将权限设置为 777。至少将其更改为 775。
  • 感谢您的推荐...您可以告诉我,我现在就从所有这些东西开始。

标签: linux shell scripting solaris ksh


【解决方案1】:

删除 #!/bin/ksh/ 中的尾随 /.. 将其留在那里也会对我造成错误。

这是我在 Linux 下使用斜杠收到的消息(比它出现的 SunOS 更具描述性):

ksh: ./so2.sh: cannot execute [Not a directory]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多