Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open Terminal from shell and execute commands [duplicate]

I am lazy so I want to write a shell script to open my dev environment. I setup two commands dev and dev-startup. When I run dev /directory/path it should open a new terminal window at /directory/path and execute dev-startup.

I'm not sure how to open the terminal window at a specific directory and then run a final command to run the tools I need to setup the environment.

I'm running OSX, so maybe AppleScript is the answer?

like image 711
Calebmer Avatar asked Jul 20 '15 19:07

Calebmer


1 Answers

Option 1 with xterm (will automatically close the window when completed):

xterm -e "cd /tmp/; watch 'pwd;date'"

Option 2 with MacOS terminal:

osascript -e 'tell application "Terminal" to do script "cd /tmp;pwd"'
like image 128
volker Avatar answered Oct 23 '22 07:10

volker