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 second command in .bashrc but I don't know how to execute the first one on every directory change :)
Any simpler solution that does not involve screen or tmux usage is welcome.