Originally Posted by arrenlex
You really don't want to. If you unset your PATH, for example, you won't be able to run any applications and you might have a ton of trouble putting it back.
I suggest running the 'env' command to list all variables defined on your system and unset only the ones you know you don't need or want.
With Linux, it's generally a very bad idea to delete something when you don't know what it is\does.
Sometimes I do want to unset everything. I build startup scripts for endusers running ic design tools. To try and have all tools run in identical environments start all my scripts with the following:
# get USER, HOME and DISPLAY and then completely clear environment
set U = $USER
set H = $HOME
set D = $DISPLAY
# set USER, HOME and DISPLAY and set minimal path.
setenv USER $U
setenv HOME $H
setenv DISPLAY $D
# initial path
set path = (/bin /usr/bin /usr/local/bin /usr/bin/X11 /usr/contrib/bin \
I grab USER, HOME and DISPLAY and flush the rest. I then set a minimal path. I would like to know how to do something similar in bash.