How to enable autocomplete feature for shell script?

0

I would like the options in my shell script to be displayed or autocompleted when pressing TAB, as with commands like aptitude or yum.

How to enable autocomplete feature for shell script?

    
asked by anonymous 31.01.2018 / 12:51

1 answer

3

The easiest way to do this is to include a shell script in /etc/bash_completion.d/. The basic structure of this file is a simple function that performs the completion and then the complete invocation which is a bash compiler. Instead of going into detail on how to use complete, I suggest you read an Introduction to the Bash Completion . Part 1 covers the basics and Part 2 goes into how you would write a completion script.

    
31.01.2018 / 13:04