[Solved] in bash can I force a `cd src` everytime I cd into a go directory? [closed]


Put

function cd()
{
    test $# -eq 0 && return 0
    if [ `basename $1` == "go" ]; then
        builtin cd "$1/src"
    else
        builtin cd "$@"
    fi
}

in your ~/.bashrc.

Note that you won’t be able to use command-line options when cd-ing into your Go directory because ideally we’d process only the last argument passed to cd but you can’t easily do this in a POSIX shell (and bash).

1

solved in bash can I force a `cd src` everytime I cd into a go directory? [closed]