
Mac OS X: Duplicate your Terminal-window in the same directory
June 11, 2007I 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.
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).
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.”