Command Line - How to List All the Shell Keywords?

bashcommand line

$ 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.

Best Answer

For this exists that shell builtin command called compgen which most certainly you did not notice it when you run help -m.

$ compgen -k
if
then
else
elif
fi
case
esac
for
select
while
until
do
done
in
function
time
{
}
!
[[
]]
coproc

See help -m compgen for more info about compgen.