Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   help with termianal (http://www.mac-forums.com/forums/os-x-development-darwin/188967-help-termianal.html)

Bika 01-30-2010 10:03 AM

help with termianal
 
Hello guys, im new at forum and im having a problem with terminals in general.

Ive been looking it a while and i hope to get the anwser here.

What I want is to find a way to open a new tab in a terminal and keep at the same directory of the current tab. ( Id like to use the classic terminal or terminator. dont like iTerm )

if anyone knows how to do it or a link that can guide me ill appreciate.

thanks in advanced!

Bika 01-30-2010 05:10 PM

could any one help me plz? anyone with same problem?

xstep 01-30-2010 09:44 PM

I don't know of any automatic way to do that within Terminal.

In preferences you can run a script, but as far as I can recall recall, you can't peak at your other terminal sessions to know where they are.

I'd just do a 'pwd' in the current terminal window. Copy the result path. Use 'cd' and paste the copied path to the end of it, with a space between them.

You could likely make an elaborate method of copying the current path of the current window to a file and reading that upon login if it exists. That gets into changing the things like the cd command and beyond where I want to go.

cptkrf 02-15-2010 06:40 PM

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


All times are GMT -4. The time now is 01:45 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.