p4() {
    if type p4-$1 1>/dev/null; then
        p4-$1 $(command -v p4) $@
    else
        command p4 $@
    fi
}

p4() {
    if type p4-$1 1>/dev/null; then
        p4-$1 $(type -p p4 | awk '{print $3}') $@
    else
        command p4 $@
    fi
}

Use type to find the actual p4 executable
Use type to find the actual p4 executable

Although command -v was working, what I really wanted was to send the absolute path of the p4
command to make sure there is no confusion as to which executable to run
