There is a POSIX version of this question elsewhere; for those that don't want to live in a cave, this is the modern version.
1 Answer
thanks to @greycat in the #bash IRC channel on freenode, the bash built-in: compgen -e will print all environment variable names:
[root@957f5a5fc6de /]# env
HOSTNAME=957f5a5fc6de
DISTTAG=f30container
PWD=/
FBR=f30
HOME=/root
LANG=C.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:...
FGC=f30
TERM=xterm
SHLVL=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env
Using the bash built-in:
[root@957f5a5fc6de /]# compgen -e
DISTTAG
FBR
FGC
HOME
HOSTNAME
LANG
LS_COLORS
PATH
PWD
SHLVL
TERM
I'm mostly posting this so I don't forget it :-)