Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extend bash-completion with the already exist completion in another file?

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!

like image 671
user3620613 Avatar asked Apr 09 '15 18:04

user3620613


People also ask

Where do bash completion files go?

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.

Does bash have tab completion?

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.

How does tab completion work bash?

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.

What is completion script?

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.


1 Answers

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

like image 112
asclepix Avatar answered Sep 30 '22 01:09

asclepix