How to unset environment variable: Difference between revisions

From razwiki
Jump to navigation Jump to search
(Created page with "In <code>bash</code>: bash-3.2$ echo $EDITOR vim bash-3.2$ unset EDITOR bash-3.2$ echo $EDITOR In <code>fish</code>: Downloads $ echo $EDITOR vim Downloads $ set -...")
 
(No difference)

Latest revision as of 14:23, 17 December 2021

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.