Skip to content

Instantly share code, notes, and snippets.

@jkeyes
Created October 21, 2010 11:54
Show Gist options
  • Save jkeyes/638358 to your computer and use it in GitHub Desktop.
Save jkeyes/638358 to your computer and use it in GitHub Desktop.
Opens a new tab in Terminal.app for the current working directory
#!/bin/sh -
if [ $# -ne 1 ]; then
PATHDIR=`pwd`
else
PATHDIR=$1
fi
/usr/bin/osascript > /dev/null <<-EOF
activate application "Terminal"
tell application "System Events"
keystroke "t" using {command down}
end tell
tell application "Terminal"
repeat with win in windows
try
if get frontmost of win is true then
do script "cd $PATHDIR; clear" in (selected tab of win)
end if
end try
end repeat
end tell
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment