Could someone please explain how the exit
command works in Unix terminal?
A search of man exit
and which exit
was not helpful and I have come across the following issue.
After installing add on packages for Anaconda and PyCharm on my new Red Hat system I noticed that when ever I called exit
to exit out of a terminal session I would get a series of errors, and then the terminal quits as expected. The errors seem to suggest that my call to exit
is triggering a call rm ~/anaconda3/.../
and rm ~/PyCharm/....
, causing an error. All of the directories also appear to be the locations of packages I downloaded for these programs (i.e. numpy), see below.
$ exit
rm: cannot remove ‘~/anaconda3/lib/python3.5/site-packages/numpy/core’: Is a directory
...
...
Resolved
In my ~/.bash_logout
file, there was a line
find ~ -xdev ( -name *~ -o -name .*~ -o -name core ) -exec \rm '{}' \;
Commenting this line out stopped the error messages. It appears to search and delete all temporary files. But it also attempts to find directories with the word "core" in them, and delete those as well. This was a preset in the system.
Best Answer
Well usually you would only see execution upon exiting a shell if you've manually configured this. But maybe one of the packages you've installed came with a bash exit shell script...
check;
maybe you'll find a script call from there, it's an odd one...