1
我有一個腳本有兩個蘋果腳本,它們打開一個新標籤並執行命令。我希望第二個蘋果腳本等到第一個蘋果腳本的命令行動作完成。我寧願不需要長時間睡眠,在它繼續之前。讓腳本等到最後一個腳本完成
有沒有辦法可以做到這一點?
以下是我有:
osascript -e 'tell application "Terminal" to activate' \
-e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' \
-e 'tell application "Terminal" to do script "cd '$current_dir'" in selected tab of the front window' \
-e 'tell application "Terminal" to do script "./my_script arg1" in selected tab of the front window'
------ Wait until this process is finished -------
osascript -e 'tell application "Terminal" to activate' \
-e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' \
-e 'tell application "Terminal" to do script "cd '$current_dir'" in selected tab of the front window' \
-e 'tell application "Terminal" to do script "./my_script different_arg1" in selected tab of the front window'
這不會對'ssh'連接工作 – Mausy5043