# bash completion for GNU make -*- shell-script -*- _make_target_extract_script() { local mode="$1" shift local prefix="$1" local prefix_pat=$(command sed 's/[][\,.*^$(){}?+|/]/\\&/g' <<<"$prefix") local basename=${prefix##*/} local dirname_len=$((${#prefix} - ${#basename})) if [[ $mode == -d ]]; then # display mode, only output current path component to the next slash local output="\2" else # completion mode, output full path to the next slash local output="\1\2" fi cat <