New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

help with termianal


Post Reply New Thread Subscribe

 
Thread Tools
Bika

 
Bika's Avatar
 
Member Since: Jan 30, 2010
Posts: 2
Bika is on a distinguished road

Bika is offline
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!
QUOTE Thanks
Bika

 
Bika's Avatar
 
Member Since: Jan 30, 2010
Posts: 2
Bika is on a distinguished road

Bika is offline
could any one help me plz? anyone with same problem?
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
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.

CameraTime - Time lapse photography for novice and advanced users.

When asking questions, post the version of your software. You'll receive better answers.

Please post your results to the thread as it is good feedback.
QUOTE Thanks
cptkrf

 
Member Since: Dec 08, 2009
Location: The same as Sheldon Cooper - East Texas
Posts: 368
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

Post Reply New Thread Subscribe


« /usr vs /Developer/usr | AppleScript Help Needed: Delete Watched TV Shows in iTunes »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

All times are GMT -4. The time now is 10:05 AM.

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

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?