Basics

Most Debian installed bash completions live under /usr/share/bash_completion/completions

complete options

Some complete options you want:

  • -o bashdefault - if no completions are found do the bash default thing
  • -o default - readline completions if both the complete function and bash expansions fail
  • -o nospace - don’t append a space at the end of matches (useful if you’re doing directory stuffs)
  • -S or -P - a prefix or suffix that is added at the end of a completion generated by the function passed to complete -F

Example