0
votes

I have requirement to open multiple tab's and invoke some services and then close them as part of shutdown.

For now all I have tried is

osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'

It opens a tab; but how can I 
a) Give the tab a name
b) Invoke a process

Also I have tried

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 "echo hello" in selected tab of the front window'

Which prints hello in the main window from where I had invoked the script.

Any suggestions would be helpful.

1

1 Answers

0
votes

I seen something like this before and someone posted this.

https://www.npmjs.com/package/ttab To install you need Node.js but its pretty easy, just run.

npm install -g ttab

There is also this bash script that installs it. https://raw.githubusercontent.com/mklement0/ttab/stable/bin/ttab