h1

Mac OS X: Duplicate your Terminal-window in the same directory

June 11, 2007

I was looking for a way to duplicate the current Terminal-window in the same directory. I wrote a
small script that does just this, save it as ~/bin/dup


#!/bin/bash
echo "cd `pwd`" > ~/.bash_last_dir
echo "rm ~/.bash_last_dir" >> ~/.bash_last_dir
echo "touch ~/.bash_last_dir" >> ~/.bash_last_dir
open -a Terminal .

If you include the following line at the end of your ~/.bash_login, you’re all set:


source ~/.bash_last_dir

Make sure the ~/bin directory is in your path, and type “dup” in your Terminal to duplicate it.

Advertisements

2 comments

  1. Ik vind de scripts in de reacties van TomP en Lliwynd op wel elegant. Die gebruiken beide geen bestand om het pad op te slaan, maar gebruiken een AppleScript in hun shell script (m.b.v. het osascript commando).


  2. Grr, WordPress haalde m’n link eruit omdat ie tussen punthaken stond. Ik bedoelde: “(…) op http://www.macosxhints.com/article.php?story=20051231110014263 wel elegant.”



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: