Reputation: 321
I have a problem with timing in a BASH script.
#!/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
How best do I wait for the app to finish properly before the sed
takes place? Currently the open
command sets up a background task like a NOHUP, and the script proceeds immediately to the sed
.
If it helps, the app is an OSX Automator workflow converted to an app.
Upvotes: 3
Views: 2009
Reputation: 27283
Use the -W
flag of open
to wait for the app to quit:
#!/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
Upvotes: 5