Bash osascript(AppleScript) in mac terminal, run multiple commands sequentially

2.3k Views Asked by At

I am trying to create a bash .sh script file that uses osascript to open 1 new terminal window/tab and then runs 2 commands "cd fs" and than "gulp" (both in the same window/tab)

This is what I am trying and it runs the second command (do script "gulp") in another (third) window/tab, not the second one that was opened.

osascript -e ' tell application "Terminal" do script "cd fs" do script "gulp" end tell'

1

There are 1 best solutions below

0
On BEST ANSWER

I was able to find the answer I was looking for

osascript -e " tell application \"Terminal\" set currentTab to do script \"cd $(pwd)\" delay 2 do script \"gulp env --env int\" in currentTab delay 5 do script \"gulp\" in currentTab delay 30 end tell"