I have found a behavior of shell I don't understand. When you execute
echo foo > /tmp/bar & exit
, the terminal is closed. But when you execute
exit & echo foo > /tmp/bar
, the terminal stays open and something like
is printed on it.
The output of the first version can be seen, too, if you log into a different account using
su, because then, only the session of the user you logged in to using
su is ended and your terminal stays open. It's something like:
 13777 exit + Done exit
Why isn't the session ended if
exit is the first command?
Just in case you can't replicate this on your Unix system: I'm using Ubuntu 16.04.