Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Open new xterm windows in current Terminal directory' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Open new xterm windows in current Terminal directory
Authored by: TomP on Jan 04, '06 10:05:12PM
As a slightly more flexible alternative, I have a little shell script ("openterminal.sh") that will open a new Terminal window in the same directory as the Terminal session from which it was invoked. Here's the script:

#!/bin/sh
# 
# Open another terminal window for the current directory
#
# Copyright 2004 by Tom Pollard - All rights reserved.
#
#set -x
CWD=`pwd`
osascript<<END
set thePath to "$CWD"
set myPath to (POSIX file thePath as alias)
try
    tell application "Terminal"
        activate
        do script with command "cd \"" & thePath & "\""
    end tell
end try
END
I have this aliased as 'ot'. So, when I want another Terminal window open to the same directory as some other Terminal window (not necessarily the last one I used or opened, I just say 'ot' in that Terminal session.

[ Reply to This | # ]