diff --git a/bash_completion b/bash_completion index c692ecb97f1..8673669a6d7 100644 --- a/bash_completion +++ b/bash_completion @@ -596,6 +596,14 @@ _filedir() compopt -o filenames 2>/dev/null COMPREPLY+=( "${toks[@]}" ) fi + + # Remove '.' and '..' from suggestions + local i + for i in "${!COMPREPLY[@]}" ; do + [ "${COMPREPLY[$i]}" = '.' -o "${COMPREPLY[$i]}" = '..' ] && \ + unset -v 'COMPREPLY[$i]' + done + COMPREPLY=( "${COMPREPLY[@]}" ) } # _filedir()