title: How to open new Terminal tab and get focus back to the prev tab?
body: <p>I want to run a command in a terminal tab which will open a new tab, run a command there too and then get the focus back to the previous Terminal tab (the one i run the first command), is it possible?
  using of corse osascript.</p>
  
  <p>what i have so far:</p>
  
  <pre><code>osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'
  osascript -e 'tell application "Terminal"' -e 'do script "cd /path/to/dir; clear;" in selected tab of the front window' -e 'end tell' &gt; /dev/null
  osascript -e 'tell application "System Events" to tell process "Terminal" to key code "48" using control down' &gt; /dev/null
  </code></pre>
  
  <p>this will only work if i have only 2 opened tabs.</p>