compgen builtin command exposure

ABOUT compgen

compgen is bash built-in command and it will show all available commands, aliases, and functions for you. 

TYPICAL COMMANDLINE EXPOSURE RELATED

$compgen -k
if
then
else
elif
fi
case
esac
for
select
while
until
do
done
in
function
time
{
}
!
[[
]]
coproc
$
$compgen -a
ls
$
$compgen -b
.
:
[
alias
bg
bind
break
builtin
caller
cd
command
compgen
complete
compopt
continue
declare
dirs
disown
echo
enable
eval
exec
exit
export
false
fc
fg
getopts
hash
help
history
jobs
kill
let
local
logout
mapfile
popd
printf
pushd
pwd
read
readarray
readonly
return
set
shift
shopt
source
suspend
test
times
trap
true
type
typeset
ulimit
umask
unalias
unset
wait
$
$cat comp.sh 
#!/bin/bash

commands=`compgen -c`
let count=1

for i in ${commands[@]}
do

        what=`whatis $i`

        echo -e "n33[38;5;148m$count. $i: 33[39m"
        echo -e "$what"

        ((count++))


done
$

$bash comp.sh  | head
if: nothing appropriate.
n33[38;5;148m1. if: 33[39m

then: nothing appropriate.
n33[38;5;148m2. then: 33[39m

else: nothing appropriate.
n33[38;5;148m3. else: 33[39m

elif: nothing appropriate.
n33[38;5;148m4. elif: 33[39m

fi: nothing appropriate.
n33[38;5;148m5. fi: 33[39m

case: nothing appropriate.
$

LINKS
https://www.cyberciti.biz/open-source/command-line-hacks/compgen-linux-command/
https://www.gnu.org/software/bash/manual/html_node/A-Programmable-Completion-Example.html