title: Multiple tabs in os X terminal using CLI
body: <p>I have requirement to open multiple tab's and invoke some services and then close them as part of shutdown.</p>
  
  <p>For now all I have tried is </p>
  
  <blockquote>
    <p>osascript -e 'tell application "Terminal" to activate' -e 'tell
    application "System Events" to tell process "Terminal" to keystroke
    "t" using command down'</p>
  </blockquote>
  
  <pre><code>It opens a tab; but how can I 
  a) Give the tab a name
  b) Invoke a process
  </code></pre>
  
  <p>Also I have tried</p>
  
  <blockquote>
    <p>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'</p>
  </blockquote>
  
  <p>Which prints hello in the main window from where I had invoked the script.</p>
  
  <p>Any suggestions would be helpful.</p>