Removing Environment Variables
Of course, if you can create a new environment variable, it makes sense that you can also remove an existing environment variable. You can do this with the unset
command. When referencing the environment variable in the unset
command, remember not to use the dollar sign:
$ echo $my_variable
I am Global now
$
$ unset my_variable
$
$ echo $my_variable
$
When dealing with global environment variables, things get a little tricky. If you're in a child process and unset a global environment variable, it applies only to the child process. The global environment variable is still available in the parent...