aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d/gd.sh
blob: 5a3f54b08a899353d9a89aef2a19676cdf2cba09 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Go to marked directory
gd() {

    # Refuse to deal with unwanted arguments
    if [ "$#" -gt 0 ] ; then
        printf >&2 'gd(): Unspecified argument\n'
        return 2
    fi

    # Complain if mark not actually set yet
    if ! [ -n "$PMD" ] ; then
        printf >&2 'gd(): Mark not set\n'
        return 2
    fi

    # Go to the marked directory
    cd -- "$PMD" || return
}