View Single Post
cptkrf

 
Member Since: Dec 08, 2009
Location: The same as Sheldon Cooper - East Texas
Posts: 364
cptkrf is a jewel in the roughcptkrf is a jewel in the rough
Mac Specs: MacMini,2013, Intel Core i7, 16gb, 27" Thunderbolt display (Highly recommended!)

cptkrf is offline
Save the following script (and be sure to chmod it to 755). Run it and it will open a new tab(s) in the same folder.




#!/bin/sh

# Make a new OS X Terminal tab with the current working directory.

if [ $# -ne 1 ]; then
PATHDIR=`pwd`
else
PATHDIR=$1
fi

/usr/bin/osascript <<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
clear
QUOTE Thanks