On 2024-06-03 07:17, Mark J. Reed wrote:
The exec builtin replaces the running shell with whatever program you run.  The point is to avoid clogging the process table with shells that are just hanging out waiting to do nothing but exit as soon as their child process finishes.
I get that. 


In your case, the script exists to set things up in the environment and then run xfce4-session; there's nothing for it to do after xfce4-session completes, so it uses exec to tidy up.

Sure.  But then what? I understand that if a script or function has nothing more to do, it may as well pre-kill itself. But the difference is that 'exec' kills the entire terminal, it doesn't just return to the prompt in a more efficient way -- which would be easy to understand, as above.  exec seems to pull the rug out from under itself, not just end a script more efficiently.  In my case, from what I've heard control seems to pass to dbus.  Mind, if dbus called the script then that's what one might expect.