aboutsummaryrefslogblamecommitdiff
path: root/sh/shrc.d/gd.sh
blob: 9f6a43e722539737b4ec749faee85554fd5005e2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                                 
                           
                                         
                


                                
                          
 
# 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 [ -z "$PMD" ] ; then
        printf >&2 'gd(): Mark not set\n'
        return 1
    fi

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