IF the file "/usr/lib/x86_64-linux-gnu/gnome-settings-daemon" exists and is executable, then..
8 #if test -x /usr/lib/x86_64-linux-gnu/gnome-settings-daemon >/dev/null; then
9 # /usr/lib/x86_64-linux-gnu/gnome-settings-daemon &
.. execute it in the background (the "&" in the last sends it to the background).
The "test" command is same as using "[ ]" with "if" condition (e.g., "if [ -x /usr/lib/x86_64-linux-gnu/gnome-settings-daemon ]; then...")
You can see the manpage for 'test' (man test) to see its detailed usage.
The ">/dev/null" in the test condition is there to mute the stdout, if any. Usually we redirect the error messages (stderr, or "2>") to /dev/null (you may call it a "black-hole" ), but the above usage is okay too (for the 'test' command, it doesn't matter whether the result is displayed or not).
If the "IF" condition above fails (either the file doesn't exist, or is not executable), then the ELSE IF part is executed -
"which" command returns the path of the executable file which provides the command supplied with "which". So the above test (the part after 'elif') returns the path of the executable (gnome-settings-daemon) in case it is in the system but not at the default path (thus failing the "IF" test previously).
10 #elif which gnome-settings-daemon >/dev/null 2>&1; then
The ">/dev/null 2>&1" part is implemented in reverse direction by the shell. Means, first the stderr (2>) gets pointed to the address of stdout (&1), thus now showing whatever stdout would be (it otherwise would have shown error messages, if any). Then, the stdout is sent to /dev/null (the 'black-hole').
I'm not very confident about it, but this arrangement is probably meant to mute both stdout and stderr (same thing achieved by ">/dev/null 2>/dev/null")
Now this one doesn't make much sense to me. In the first line, either "which", or the path are unnecessary (the 'which' command already returns the path). But anyway, this is what it seems to be testing/doing -
18 if which /usr/lib/openbox/xdg-autostart >/dev/null; then
19 /usr/lib/openbox/xdg-autostart $DESKTOP_ENV
IF the file "/usr/lib/openbox/xdg-autostart" exist and is executable, then..
..execute it with argument "$DESKTOP_ENV" (which according to the script, evaluates to "OPENBOX" if the current Desktop Session is not "gnome")
So the summary of the script is -
1) The commented, thus now disabled part : If gnome-settings-daemon exists in the system, and is executable, run it.
2) The active part : If the current Desktop Session is NOT gnome, start OPENBOX with xdg-autostart.
Have no idea about that, probably a regular Lubuntu user can answer that.
Originally Posted by vasa1