Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 无法在终端中运行shell脚本_Bash_Shell_Terminal - Fatal编程技术网

Bash 无法在终端中运行shell脚本

Bash 无法在终端中运行shell脚本,bash,shell,terminal,Bash,Shell,Terminal,我以前能够在终端中运行shell脚本,通过以下方式使其可执行: sudo chmod a+x /path/to/script 用它来运行它 /path/to/script/./scriptToRun.sh 以下是输出: 文件:dir,节点:Top这是信息树的顶部 This (the Directory node) gives a menu of major topics. Typing "q" exits, "?" lists all Info commands, "d" retur

我以前能够在终端中运行shell脚本,通过以下方式使其可执行:

sudo chmod a+x /path/to/script
用它来运行它

/path/to/script/./scriptToRun.sh
以下是输出: 文件:dir,节点:Top这是信息树的顶部

  This (the Directory node) gives a menu of major topics.
  Typing "q" exits, "?" lists all Info commands, "d" returns here,
  "h" gives a primer for first-timers,
  "mEmacs<Return>" visits the Emacs manual, etc.

  In Emacs, you can click mouse button 2 on a menu item or cross reference
  to select it.

* Menu:

Texinfo documentation system
* Info: (info).                 How to use the documentation browsing system.
* Texinfo: (texinfo).           The GNU documentation format.
* info stand-alone: (info-stnd).           Read Info documents without Emacs.
* infokey: (info-stnd)In
现在它打开了emacs,我似乎无法再运行脚本了

文件中有shebang,即/bin/bash-e

如果有人能解决这个问题,我将不胜感激。

试试这个

$ cd /path/to/script && ./myscript.sh

如果它不起作用,请以超级用户身份运行此命令

它应该使脚本可执行,而不是运行它。你有化名sudo吗?您是否创建了一个名为sudo或chmod的新脚本?对不起,我的意思是可执行文件将编辑问题如果您运行上述命令,您实际上会使包含的目录可执行,而不是脚本本身,因此您可能希望chmod a+x脚本。如果不是这样,请列出脚本的内容供我们查看,尤其是!行。看起来info命令是从scriptToRun.sh脚本中执行的。找到错误。正在从错误的文件夹运行脚本,并且缺少一些导入/依赖项。