For example, there is bash-completion for rar on linux, I want to extend, make more completions for the same command - rar, maybe for my own filename extension, but I don't want to touch the already existing completion script, how to start it?
Thanks!
A. Put them in the completions subdir of $BASH_COMPLETION_USER_DIR (defaults to $XDG_DATA_HOME/bash-completion or ~/. local/share/bash-completion if $XDG_DATA_HOME is not set) to have them loaded automatically on demand when the respective command is being completed.
Bourne shell and csh do not, but ksh, bash, tcsh, and zsh all have tab completion to varying degrees. The basic principle in all of these shells is the same; you type the start of the word, hit the <TAB> key twice, and the list of possible commands or files is displayed.
The programmable completion feature in Bash permits typing a partial command, then pressing the [Tab] key to auto-complete the command sequence. [1] If multiple completions are possible, then [Tab] lists them all.
The completion script is code that uses the builtin Bash command complete to define which completion suggestions can be displayed for a given executable. The nature of the completion options vary, from simple static to highly sophisticated.
The base support is usally in /etc/bash_completion
and details in the directory /etc/bash_completion.d
For more information, see:
An introduction to bash completion: part 1 for general knowledge
An introduction to bash completion: part 2 for details on scripts in /etc/bash_completion.d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With