Ubuntu – How to create script with auto-complete


When I use program like svn and I type in Gnome Terminal:

svn upd

and hit Tab it's autocompleted to:

svn update

Is it possible to do something like that in my custom bash script?

Best Answer

You can use the Programmable Completion. Have look at /etc/bash_completion and /etc/bash_completion.d/* for some examples.