【问题标题】:AppleScript run set of terminal commands without waitingAppleScript 无需等待即可运行一组终端命令
【发布时间】:2013-01-21 22:26:25
【问题描述】:

我正在编写一个 AppleScript 应用程序。我的代码中有一个do shell script 部分,看起来像这样:

unlink file.file; mv file1.file file2.file; sleep 3; open app.app;

无论如何,我需要在不中断脚本且不打开终端窗口的情况下运行它。我已经知道> /dev/null 2>&1 & 的事情,但这对我不起作用,因为我需要按顺序运行这些,而且我无法让它与这样的多个命令一起工作。任何帮助将不胜感激。

【问题讨论】:

  • 你为什么不直接用 AppleScript 做上面的事情——这部分似乎不需要成为一个 shell 脚本?

标签: macos bash shell terminal applescript


【解决方案1】:

您可以将整个命令列表作为一个组运行:

{ unlink file.file; mv file1.file file2.file; sleep 3; open app.app; } >/dev/null 2>&1 &

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-28
    • 1970-01-01
    相关资源
    最近更新 更多