Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: exec



Your shell is never the only process running on the computer. Certainly not if you're using a GUI; the terminal emulator is running, to carry what you type to the shell and what it outputs back to you. The window system is running, to display what the terminal emulator and other windows have to say and respond to the keyboard and mouse and so on.  When the shell exits, the terminal may also (as I said, that's configurable), but there's no reason for everything else to. You can just fire up another terminal and keep going, or continue to interact with non-command-line applications like your web browser.

In X11 setups back in the day, it wasn't uncommon for the .xinitrc or whatever startup file you use to end with something like exec xterm, so if that particular instance of xterm exited, then the whole window system went away with it. But that's not typical of modern systems. And even then the computer wouldn't shut down. You'd just be dropped back at your original shell on the console, or if you'd also exec'ed xinit, at a login prompt.

On Mon, Jun 3, 2024 at 11:23 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:


On 2024-06-03 07:54, Mark J. Reed wrote:
>  Exec has the same impact on the shell as exit - shell go bye bye - it
> just leaves another program in its place.

So I see.  So it's not just a question of a script removing itself from
memory at the point where control passes, it's 'exit' as we see.  Still,
the question of who gets control is there -- the computer does not shut
off.  But again, that question would be there anyway so 'exec' doesn't
make the question any more difficult.  I guess as far as zsh is
concerned that's as much as can be said.





--
Mark J. Reed <markjreed@xxxxxxxxx>


Messages sorted by: Reverse Date, Date, Thread, Author