What are commands to find shell keywords, built in functions and user defined functions?
You can also use compgen
in bash
:
compgen -k
lists keywordscompgen -b
orenable
lists builtinscompgen -A function
ordeclare -F
lists functionscompgen -a
oralias
lists aliasescompgen -c
lists commandscompgen -v
lists variablescompgen -e
orexport
lists exported variables
With zsh:
PATH= type -m '*'
Will tell you all 3.
In bash, to list the keywords, you can do:
complete -A keyword :
and then type : <Tab><Tab>
For builtins, replace keyword
with builtin
above and for functions, I'll let you guess.
In Bash:
man bash | grep -10 RESERVED
lists reserved words:! case coproc do done elif else esac fi for function if in select then until while { } time [[ ]]
declare -F
andtypeset -F
shows function names without their contents.enable
lists builtin shell commands (I don't think these are functions as such).So doesman builtins