Results 1 to 4 of 4
  1. #1
    help with termianal
    Bika's Avatar
    Member Since
    Jan 30, 2010
    Posts
    2
    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!

  2. #2
    help with termianal
    Bika's Avatar
    Member Since
    Jan 30, 2010
    Posts
    2
    could any one help me plz? anyone with same problem?

  3. #3
    help with termianal
    xstep's Avatar
    Member Since
    Jun 25, 2005
    Location
    On the road
    Posts
    3,231
    Specs:
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    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.

  4. #4
    help with termianal
    cptkrf's Avatar
    Member Since
    Dec 08, 2009
    Location
    The same as Sheldon Cooper - East Texas
    Posts
    453
    Specs:
    iMac 2014 i5 5k 32gb 1tb fusion, second TB display, 2014 MBA
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •