I want to learn how to write bash completion scripts. Which tutorial would you recommend?
Asked
Active
Viewed 7.6k times
90
-
2What do you mean by "bash completion tutorial"? Please explain. – Patkos Csaba Dec 10 '10 at 21:14
-
1the explanation is needed on the word "tutorial", what do you actually need? – phunehehe Dec 11 '10 at 00:26
-
2@Tshepang: I guess you mean you want to learn how to write bash completion routines? Using bash completion is pretty easy, you just hit the `tab` key. – intuited Dec 11 '10 at 04:45
-
11You may want to check out the link I provide in my answer here: http://unix.stackexchange.com/questions/1800/custom-autocomplete – Steven D Dec 11 '10 at 05:45
-
so this will become a duplicate I guess – phunehehe Dec 11 '10 at 16:56
-
2@Tshepang People don't generally delete comments, particularly ones that are still valid like Steven's. Keep in mind that the answers here aren't just for you -- they're for everyone who googles "bash completion tutorial" in the future – Michael Mrozek Dec 13 '10 at 15:28
-
10How come this question is considered "too broad" ? That's ridiculous. It's perfectly valid, and answers provided prove it's not so easy to find out. – Cyan Mar 19 '15 at 00:02
-
The Advanced Bash-Scripting Guide is always a good starting point: http://www.tldp.org/LDP/abs/html/tabexpansion.html – ceving Dec 07 '15 at 11:24
-
Hi @terdon, since this question is rightfully closed, can a question this was flagged as a dupe of be reopened? http://unix.stackexchange.com/q/1800 is a good question, and should be reopened if this one is closed. – cat Apr 10 '16 at 14:00
-
1@cat fair enough, done. – terdon Apr 11 '16 at 07:47
-
I recommend next: http://askubuntu.com/a/483149/24155 – Eduardo Cuomo Jun 24 '16 at 14:32
-
1I wrote one, you can find it here: https://iridakos.com/tutorials/2018/03/01/bash-programmable-completion-tutorial.html – Lazarus Lazaridis Sep 28 '18 at 17:44
2 Answers
60
There aren't that many bash completion tutorials around, but this one is pretty good:
Introduction to Bash Completion
- Part 1 is for general knowledge
- Part 2 covers creating scripts in /etc/bash_completion.d/
Gerald Schneider
- 681
- 9
- 20
wag
- 35,104
- 11
- 66
- 51
22
I would start by looking at the library of bash completions already put together by the folks here:
http://bash-completion.alioth.debian.org/
They also have a mailing list:
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-devel
Victor
- 133
- 6
Andre Stechert
- 371
- 2
- 3
-
3
-
It's appears dead since around may. The archive is only moderately useful, as it redirects to the corresponding github repo. https://web.archive.org/web/20180507171315/http://bash-completion.alioth.debian.org/ – Aiyion.Prime Dec 09 '18 at 22:02
-
That Github repo being here: https://github.com/scop/bash-completion – AstroFloyd May 24 '19 at 16:37