Not able to 'unset' environmental variable permanently - UBUNTU
Solution 1:
The environment variable is always going to be set if it's present in your configuration files for your system's environment variables or your own login profiles.
Open each of these files and search for a line that has export CATALINA_HOME
, and remove the line (or comment it out) where present:
/etc/environment
/etc/profile
~/.profile
~/.bashrc
Once removing the line from the file, log out, and log back in (if in a terminal, just close the terminal and reopen it). If it was in /etc/environment
then consider rebooting the system first.
With the export
line gone, the variable will be 'permanently unset' until the line is readded to one of those files.
Solution 2:
Just to supplement the existing good answer, here's a simple line to help you to find the file you need to edit, based on this answer:
egrep -lir "export variable" /etc/environment /etc/profile ~/.profile ~/.bashrc
The word enclosed in quotes is the name of the environment variable it will search for.
It will provide you with the filename, then you just need to find the corresponding exprot line and comment or delete it.
Solution 3:
add unset CATALINA_HOME
to the shell file (.bashrc or .zshrc)