Archive for June, 2007

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