$ type if
if is a shell keyword
I don't know the other shell keywords.
Is there any command to list all the bash shell keywords.?
Note: help -m
displays both shell builtins and shell keywords.
$ type if
if is a shell keyword
I don't know the other shell keywords.
Is there any command to list all the bash shell keywords.?
Note: help -m
displays both shell builtins and shell keywords.
For this exists that shell builtin command called
compgen
which most certainly you did not notice it when you runhelp -m
.See
help -m compgen
for more info aboutcompgen
.Idea taken from here:
In bash, to list all keywords, first run the following command in terminal:
Then type at the prompter: :SpaceTabTab.
Works very well for me: