How can I open multiple tabs automatically on terminal in mac os Lion by executing some commands on each tab?
macos, tabs, terminal
Solution
I can give you a clue.
Using `osascript`, you can do it.
UPDATE:
One thing you need to understand is, `gnome-terminal` is for Linux. `Gnome` is a very popular Desktop environment written for Linux.
Use this oneliner for opening a new tab with $PWD as the working directory:
osascript -e "tell application \"Terminal\"" -e "tell application \"System Events\" to keystroke \"t\" using {command down}" -e "do script \"cd $PWD; clear\" in front window" -e "end tell" > /dev/null
Following one liner will just open a new tab with `$PWD` as working directory and will execute `echo Hi`
osascript -e "tell application \"Terminal\"" -e "tell application \"System Events\" to keystroke \"t\" using {command down}" -e "do script \"cd $PWD; echo HI\" in front window" -e "end tell" > /dev/null
Problem
I need to automatically open terminal with multiple tabs and need to execute multiple commands on it. I know how to do it in ubuntu. but its not working on mac os . Any Idea? ``` gnome-terminal --tab -e "tail -f somefile" --tab -e "some_other_command" ```