Bhasker C V wrote: > .xsession is a file which to my knowledge can only take one command > at the end. The file must is not 'shelled' but 'exec'ed. > So you can place commands in the file one per line or a script > but the end of the file must be an exec and not a script/command that > returns.
I think you know this but the description here was vague enough that I wanted to clarify it. More precisely the X startup script waits for the command to return. When the script exits the session is closed. Therefore we do not want the process id of the script to exit until we log out. Therefore we 'exec' the window manager. The script goes away and is overlayed by the window manager process. It keeps the same process id and the same parent process is waiting for it to finish. When you exit the window manager the parent detects that the child process has quit and terminates the X window session. In the past I have seen other less efficient things. Example: twm & wait The & puts the twm window manager in the background and then the wait command causes the shell to wait forever for it to finish. Because otherwise the shell would terminate and the session would end. But this is less efficient than the exec because a useless shell process is left waiting for the child for no good reason. But so it was for many years in many X startx scripts. It is not much overhead but why have any? So in modern years best practice says to use 'exec' and to eliminate the useless shell process entirely. > Or in other words, the .xsession file can be placed in your home > directory which will be souced and commands executed from the file and > the X session lasts until the .xsession file completes and returns (the > last command returns ) Correct. > X session will also last till all the clients connected to the X session > terminates. > > eg:- > If you place this command > sleep 20 > > then the X session will last for 20 seconds and after 20 seconds when > the sleep command exits, the X window will close. Yes. More details can be seen by tracing through the X startup scripts at /etc/X11/Xsession Bob -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

