# bash completion for GNU make -*- shell-script -*- function _make_target_extract_script() { local mode="$1" shift local prefix="$1" local prefix_pat=$( printf "%s\n" "$prefix" | \ sed 's/[][\,.*^$(){}?+|/]/\\&/g' ) 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 <