How can I open a new terminal in the same directory of the last used one from a window manager keybind?

view full story

http://unix.stackexchange.com – I'm using a tiling window manager and I switched from gnome-terminal with multiple tabs to multiple urxvt instances managed by the window manager. One of the features I miss is the ability to open a new terminal that defaults to the working directory of the last one. In short: I need a way to open a new urxvt (bash) that defaults to $PWD of the last used one. The only solution that comes to my mind is to save the current path on every cd with something like this: echo $PWD > ~/.last_dir and restore the path on the new terminal in this way: cd `cat ~/.last_dir` I can source the secon (HowTos)