代码之家  ›  专栏  ›  技术社区  ›  Tim

bash等待打开的应用程序完成,然后继续

  •  2
  • Tim  · 技术社区  · 7 年前

    我在bash脚本中的时间安排有问题。

    #!/usr/local/bash
    open /apps/my.app #this generates a text file; may take a few seconds. Then the app closes.
    sed 's/....' new_text_file.txt; #this modifies the text file
    

    我该如何等待应用程序在 sed 发生了吗?目前 open 命令设置一个类似nohup的后台任务,脚本将立即进入 塞德 . 如果有帮助的话,这个应用程序是一个OSX自动程序工作流,它被转换为一个应用程序。

    1 回复  |  直到 7 年前
        1
  •  1
  •   L3viathan gboffi    7 年前

    -W open 要等待应用程序退出:

    #!/usr/local/bash
    open -W /apps/my.app #this generates a text file; may take a few seconds. Then the app closes.
    sed 's/....' new_text_file.txt; #this modifies the text file