title: How can I get rid of this osascript output?
body: <p>The following question relates to an answer that was posted on <a href="https://stackoverflow.com/questions/989349/running-a-command-in-a-new-mac-os-x-terminal-window">this question</a>:</p>
  
  <p>I like the notion of creating my own function that opens a new terminal, so the script that Craig Walker linked to in that above-referenced question suited my needs. The script, written by Mark Liyanage, is found <a href="http://www.entropy.ch/blog/Mac+OS+X/?permalink=Terminal_tricks_8220_term_8221_and_8220_clone_8221.html" rel="nofollow noreferrer">here.</a></p>
  
  <p>That script is this:</p>
  
  <pre><code>#!/bin/sh
  #
  # Open a new Mac OS X terminal window with the command given
  # as argument.
  #
  # - If there are no arguments, the new terminal window will
  #   be opened in the current directory, i.e. as if the command
  #   would be "cd `pwd`".
  # - If the first argument is a directory, the new terminal will
  #   "cd" into that directory before executing the remaining
  #   arguments as command.
  # - If there are arguments and the first one is not a directory,
  #   the new window will be opened in the current directory and
  #   then the arguments will be executed as command.
  # - The optional, leading "-x" flag will cause the new terminal
  #   to be closed immediately after the executed command finishes.
  #
  # Written by Marc Liyanage &lt;http://www.entropy.ch&gt;
  #
  # Version 1.0
  #
  
  if [ "x-x" = x"$1" ]; then
      EXIT="; exit"; shift;
  fi
  
  if [[ -d "$1" ]]; then
      WD=`cd "$1"; pwd`; shift;
  else
      WD="'`pwd`'";
  fi
  
  COMMAND="cd $WD; $@"
  #echo "$COMMAND $EXIT"
  
  osascript 2&gt;/dev/null &lt;&lt;EOF
      tell application "Terminal"
          activate
          do script with command "$COMMAND $EXIT"
      end tell
  EOF
  </code></pre>
  
  <p>I made one change to the script on the linked site; I commented out the line that outputs "$COMMAND $EXIT" to eliminate some verbosity. However, when I run the script I still get this output</p>
  
  <pre><code>tab 1 of window id 2835
  </code></pre>
  
  <p>just before it opens the new window and executes the command that I pass in. Any ideas why this would be happening? (I tried moving the redirect of stderr to /dev/null before the call to oascript, but that made no difference.)</p>