Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.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等待打开的应用程序完成,然后继续_Bash_Macos - Fatal编程技术网

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

bash等待打开的应用程序完成,然后继续,bash,macos,Bash,Macos,我对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的后台任务,脚本立即进入sed。 如果

我对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的后台任务,脚本立即进入
sed

如果有帮助,该应用程序是一个OSX Automator工作流,已转换为应用程序。

使用
打开的
-W
标志等待该应用程序退出:

#!/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