Questions tagged [compgen]

Use when this bash builtin command is being called independently of standard autocompletion, which is the more usual tag.

Filter by
Sorted by
Tagged with
4
votes
1answer
163 views

Can a bash script include its own auto-completions?

There are many resources available (1, 2, 3) that explain how to make use of bash's ability to auto-complete commands and arguments, but all of these resources require the addition of code to a user's ...
4
votes
0answers
46 views

Bash completion own compgen prefix

I have a simple bash completion script that essentially invokes my (non-bash) program and set its output to COMREPLY, i.e. COMPREPLY=( $(my-program -- "${COMP_WORDS[@]}") ) Some of the options ...
1
vote
1answer
110 views

compgen and SELinux

I have an app, browser shell and I'm executing this command to get list of execuables (List all binaries from $PATH) compgen -A function -abck | sort | uniq and when I call this command It return ...
1
vote
0answers
154 views

How does readline use compgen to get all applicable completions?

I'm building an alternative to readline and would like to have tab completion in a similar way to how readline has tab completion. In readline, if you type git <tab> you get all the git ...
1
vote
1answer
161 views

How to use bash command completion so that only files within a particular directory are completed?

Suppose I have a bash function specialcat that cats a file in the ~/Special directory specialcat () { cat ~/Special/$1 } Suppose the ~/Special directory was set up like so: mkdir ~/Special echo ...
41
votes
2answers
34k views

Understand `compgen` builtin command

From help compgen: $ help compgen compgen: compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix] [-S suffix] [word] ...
4
votes
1answer
994 views

compgen warning: -C option not working as I expected

What is the correct way to use the compgen -C option? I'm trying to learn about Bash programmable completion, and in particular the compgen builtin function. I'm experimenting with the different ...
5
votes
2answers
4k views

autocomplete filenames using compgen

As part of a larger autocomplete function I'm writing, I want to use compgen to generate a list of files. I read the bash manual entries for compgen and complete, and from there I assumed that the ...
15
votes
1answer
1k views

How to output string completions to stdout?

Some of the git commands have many options, and it would often be useful to search through them for the one I need - I was just looking for the option which controls the TAB width in git-gui, but ...