I made a script say, dosomething.sh and I want to provide a list of tab-complete options for so that when I do

./something.sh <TAB>

I want to provide a list of options when TAB is pressed, e.g. a list of dir in ANOTHER pre-defined folder (i.e. not the current one), or some list that I define elsewhere.

Is it possible to provide customised TAB hints to shell scripts that I write?

  • 1
    Compare this and check /usr/share/bash-completion/completions/. Maybe you can reverse-engineer existing files that provide completions for already existing commands. In my Debian the scripts for dd or sudo are relatively simple; the one for ssh is more complex. – Kamil Maciorowski Mar 26 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.