aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/cd.bash
blob: 9154291bf5d45e8580aeb9b837798b05082bae6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
# If given two arguments to cd, replace the first with the second in $PWD
function cd {
    if [[ -n "$2" ]]; then
        builtin cd "${PWD/$1/$2}"
    elif [[ -n "$1" ]]; then
        builtin cd "$1"
    else
        builtin cd
    fi
}