gaustin (owner)

Fork Of

Revisions

gist: 133533 Download_button fork
public
Public Clone URL: git://gist.github.com/133533.git
Embed All Files: show embed
Bash #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Bash snippet to open new shells in most recently visited dir.
# Useful if you want to open a new terminal tab at the present
# tab's location.
#
# Put this in your .bashrc or whatever.
 
pathed_cd () {
    if [ "$1" == "" ]; then
cd
else
cd "$1"
    fi
pwd > ~/.cdpath
}
alias cd="pathed_cd"
 
if [ -f ~/.cdpath ]; then
cd $(cat ~/.cdpath)
fi