How to unset environment variable

From razwiki
Jump to navigation Jump to search

In bash:

bash-3.2$ echo $EDITOR
vim
bash-3.2$ unset EDITOR
bash-3.2$ echo $EDITOR

In fish:

Downloads $ echo $EDITOR
vim
Downloads $ set -e EDITOR
Downloads $ echo $EDITOR

A common use case is that editing the .profile does not remove environment variables that have been commented out, so they need to be erased manually. Perhaps a fancy script could parse the .profile and find commented out settings, then unset them.