I would like to create a bash script foo.sh.

When it runs, it will prompt for a directory. The user will be able to use tab to auto complete?

Here is some example code assuming read has some option.

echo -n "Enter the directory of awesomeness: "
read --enable-autocomplete DIR_OF_AWESOMENESS
echo "The Dir of Awesomeness is $DIR_OF_AWESOMENESS"

Thanks!

link|improve this question

77% accept rate
feedback

1 Answer

up vote 3 down vote accepted

Bash auto-completion works on command-line arguments. Here is a two-part introduction for writing auto-completion with examples.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.