Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.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
Macos 从另一个脚本运行脚本_Macos_Bash_Command - Fatal编程技术网

Macos 从另一个脚本运行脚本

Macos 从另一个脚本运行脚本,macos,bash,command,Macos,Bash,Command,我的脚本位于/tmp/“我的批处理脚本文件”//Processing 如果它是可执行的,我将如何在另一个脚本中从主目录/tmp/运行它: "/tmp/My Batch Script Files/Processing" arg1 arg2 ... 如果不可执行,则使其可执行或: bash "/tmp/My Batch Script Files/Processing" arg1 arg2 ... 您可以像我一样在整个路径名周围,或在包含空格的组件周围,或几乎在两者之间选择的任何其他位置放置双引号

我的脚本位于/tmp/“我的批处理脚本文件”//Processing

如果它是可执行的,我将如何在另一个脚本中从主目录/tmp/运行它:

"/tmp/My Batch Script Files/Processing" arg1 arg2 ...
如果不可执行,则使其可执行或:

bash "/tmp/My Batch Script Files/Processing" arg1 arg2 ...
您可以像我一样在整个路径名周围,或在包含空格的组件周围,或几乎在两者之间选择的任何其他位置放置双引号。只需两个双引号,就可以将它们放在一起:

/tmp/My" Batch Script "Files/Processing arg1 arg2 ...
如果您愿意,也可以使用反斜杠(不过我不推荐):

但总的来说,我同意第一个建议,或者使用:

proc_script="/tmp/My Batch Script Files/Processing"

"$proc_script" arg1 arg2 ...
如果在外部脚本运行时生成文件名,则这一点尤其有吸引力

proc_script="/tmp/My Batch Script Files/Processing"

"$proc_script" arg1 arg2 ...