1

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 1

4

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 :-)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.