new terminal at current path

On 2013/02/22, in osx, signal, by a b

So… it’s possible I’m a nerd.

My latest reason for suspecting this is that I was laying awake at night wondering how to open a new OSX Terminal window at the path of the current window. Then I woke up, figured it out while I was on the bus to work, and was happy. When I got to my office I plugged into the Goog and found about 50 answers to my question, all from about 12 years ago. Le Sigh. However, I’m still quite proud because my solution is bang-on what most folks had come up with, and lacking in feature creep by comparison.

# new terminal window at current location
function terminal-here() {
    osascript -e 'on run argv
        tell app "Terminal"
            do script "cd " & item 1 of argv
        end tell
    end run' `pwd`
}

That’s all.

 

Comments are closed.