Ubuntu: config file of shell complete


I want add autocompletion to my script. I wrote bash code for autocomplete (using this tutor http://tldp.org/LDP/abs/html/tabexpansion.html) and put it to /etc/bash_completion.d/ then i execute in bash complete -F _main_complete -o filenames ./script.sh and it's works.

But after reboot I need write this command again.

Sure I can add this to .bashrc, but it looks bad. Where config file for complete located?


It appears that, for a login shell,

  1. /etc/profile will source
  2. /etc/profile.d/bash_completions.sh, which will source
  3. /usr/share/bash-completion/bash_completion, which will source
  4. ~/.bash_completion

assuming all those files exist and are readable.

Put your own completions in ~/.bash_completion

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »