snippetbashTip
compgen — Bash built-in command for generating possible completion matches in Bash. Usually used within custom
Viewed 0 times
commandcompgencligeneratingforbuiltbash
Problem
How to use the
compgen command: Bash built-in command for generating possible completion matches in Bash. Usually used within custom completion functions. See also: complete, compopt. More information: <https://www.gnu.org/software/bash/manual/bash.html#index-compgen>.Solution
compgen — Bash built-in command for generating possible completion matches in Bash. Usually used within custom completion functions. See also: complete, compopt. More information: <https://www.gnu.org/software/bash/manual/bash.html#index-compgen>.List all shell built-ins, aliases, functions, and executables that you could run:
compgen -cList all commands that you could run that start with a specified string and save results to
$COMPREPLY:compgen -V COMPREPLY -c {{str}}Match against a wordlist:
compgen -W "{{apple orange banana}}" {{a}}List all aliases:
compgen -aList all functions that you could run:
compgen -A functionShow shell reserved keywords:
compgen -kSee all available commands/aliases starting with
ls:compgen -ac {{ls}}List all users on the system:
compgen -uCode Snippets
List all shell built-ins, aliases, functions, and executables that you could run
compgen -cList all commands that you could run that start with a specified string and save results to `$COMPREPLY`
compgen -V COMPREPLY -c {{str}}Match against a wordlist
compgen -W "{{apple orange banana}}" {{a}}List all aliases
compgen -aList all functions that you could run
compgen -A functionContext
tldr-pages: common/compgen
Revisions (0)
No revisions yet.