mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-19 20:01:32 +00:00
Update cheatsheets
This commit is contained in:
18
tldr/compgen
18
tldr/compgen
@@ -5,16 +5,22 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# compgen
|
||||
|
||||
> A built-in command for auto-completion in Bash, which is called on pressing `<Tab>` key twice.
|
||||
> 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 commands that you could run:
|
||||
- List all shell built-ins, aliases, functions and executables that you could run:
|
||||
|
||||
`compgen -c`
|
||||
|
||||
- List all commands that you could run that start with a specified string:
|
||||
- List all commands that you could run that start with a specified string and save results to `COMPREPLY`:
|
||||
|
||||
`compgen -c {{str}}`
|
||||
`compgen -V COMPREPLY -c {{str}}`
|
||||
|
||||
- Match against a wordlist:
|
||||
|
||||
`compgen -W "{{apple orange banana}}" {{a}}`
|
||||
|
||||
- List all aliases:
|
||||
|
||||
@@ -35,7 +41,3 @@ source: https://github.com/tldr-pages/tldr.git
|
||||
- List all users on the system:
|
||||
|
||||
`compgen -u`
|
||||
|
||||
- Display help:
|
||||
|
||||
`compgen --help`
|
||||
|
||||
Reference in New Issue
Block a user