【问题标题】:error in running a sh file运行 sh 文件时出错
【发布时间】:2014-11-20 11:40:23
【问题描述】:

我有一个简单的 sh 文件,但我在尝试安装软件时失败了。我首先运行了命令:

chmod +x azx_installer.sh

然后我输入这个:

sh azx_installer.sh 但它给了我以下错误:

chmod: cannot create /home/andrelima/Desktop/azx.desktop: Directory nonexistent

这附近发生了什么?

【问题讨论】:

  • 这是因为在你的脚本中你试图做一些不正确的事情。分享您的代码,以便我们了解它是什么。
  • 目录/home/andrelima/Desktop/是否存在?

标签: bash shell ubuntu


【解决方案1】:

首先,您不需要使脚本可执行并且另外在sh 中运行它。 使用语法

sh script

很好。如果您使脚本可执行,您还必须检查魔术 cookie(要了解更多信息,请向 google 询问“Shebang”)。

那么就可以使用语法了:

sh -x script

查看执行的命令。它被称为 xtrace (google(sh xtrace))。 这是一个不错的功能,试试吧。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-22
    • 2012-03-07
    • 2018-02-10
    • 2015-04-26
    相关资源
    最近更新 更多