I want to make:
env | egrep -o '^\w+=' | unset
The problem is that:
env | egrep -o '^\w+='
prints things like (pay attention to the equal sign):
XDG_VTNR = LC_PAPER = SSH_AGENT_PID = KDE_MULTIHEAD = LC_ADDRESS = XDG_SESSION_ID =
How to extract only variable names so that I can disable them?
You need something more:
for i in `env | sed 's/=.*//'` ; do unset $i done
Note, however, this is likely to do more things than you want. EG, he will also cut off your path!