Bash: autocomplete from list

by Afsheen Ghorashyon 2010-08-01T00:23:34+00:00
This is a multi-part message in MIME format.
This is a multi-part message in MIME format.
Let us assume that I have a text file with expressions separated by line
breaks.
I would like Bash to include the expressions of this text file in its
search when I press double-tab (autocomplete).
Is this possible? How would I do it? Programming is no foe of mine.
Thanks,
Grasswistle


Let us assume that I have a text file
with expressions separated by line breaks.
I would like Bash to include the expressions of this text file in its
search when I press double-tab (autocomplete).
Is this possible? How would I do it? Programming is no foe of mine.
Thanks,
Grasswistle

Re: Bash: autocomplete from list

by Luis Pauloon 2010-08-01T13:22:55+00:00.
On Sun, Aug 1, 2010 at 1:23 AM, Afsheen Ghorashy wrote:
But ii the expressions are commands you want an easier way to type
them at the prompt, try the bash aliases.
See http://tldp.org/LDP/Bash-Beginners-Guide/html/sect-03-05.html, for example
Hope it helps
Regards
Luis

Re: Bash: autocomplete from list

by Hal Burgisson 2010-08-01T13:46:08+00:00.
On Sun, Aug 1, 2010 at 9:22 AM, Luis Paulo wrote:
It would be worth looking at some programmable completion tutorials.
Programmable completion is available with bash and allows for
customizing the completion options. Its pretty flexible.
http://tldp.org/LDP/abs/html/tabexpansion.html

Re: Bash: autocomplete from list

by Afsheen Ghorashyon 2010-08-01T15:29:08+00:00.
Le 01/08/2010 9:46 AM, Hal Burgiss a écrit :
I'll definitely look into this.
Thank you for this push in the right direction.
Grasswistle

Re: Bash: autocomplete from list

by Tom Hon 2010-08-01T20:50:33+00:00.
On Sun, Aug 1, 2010 at 9:46 AM, Hal Burgiss wrote:
The UseGetOpt.sh on the url above is very similar to the scripts in
"/etc/bash-completion.d" but I am not sure that it is entirely
applicable in your case; you will have to create specific scripts for
each expression in your file. You have to ensure that bash completion
is uncommented (I think that it is by default by I replace these files
without looking at them so I don't know) in .bashrc.
I have some custom ones for the initctl commands - start, stop,
restart, reload - so I can type, for example, "sto av"
instead of typing "sto avahi-daemon". So, AFAIK, it is only
useful if you have a two-word command. For one-word commands, you
should create aliases.