Path Finder is a wonderful Finder replacement/add-on, with great features like integrated text editing, easy metadata tweaking, and quick navigation. One cool feature is the Terminal drawer -- a little terminal that slides out below your browsing window. It starts out in the same directory as the browsing window, but doesn't stay in sync as you either move in the window, or cd in the terminal.
In the spirit of this hint, here are two new bash functions, pff and pft. pff changes the Terminal working directory to the current Path Finder folder; pft changes the frontmost window to the current Path Finder Terminal directory. Using these together, you can quickly hop back and forth between the browsing window and the terminal.
To use, copy and paste this code, and paste it into your .bashrc.
[robg adds: These scripts worked for me in testing; just type pff to set the Terminal to the currently active Path Finder directory, and pft to move the Path Finder directory to the active Terminal directory. One minor caveat -- to make a directory active in the Path Finder window, you need to select something inside the directory. So if you're trying to get the Terminal window to go to /dir1/dir2/dir3, make sure you've clicked on an item within dir3 in the Path Finder window. Otherwise, the pff command will leave you in dir2. And if you haven't checked out Path Finder, it's well worth the time to do so; it's an amazingly versatile tool, and a (long ago) Pick of the Week.]
Mac OS X Hints
http://hints.macworld.com/article.php?story=20050413201826795