On Fri, 18 Feb 2005 22:15:25, Thomas Hood wrote:
On Fri, 2005-02-18 at 21:53 +0100, Alessandro Garberi wrote:
> I'm not sure this is a bug, but I think so!
> Almost every initscript (/etc/init.d/*) ends with "exit 0", but ten of
> these files have a column (:) before the line.
Yes. Weird. I wonder what the purpose is.
It's just a matter of taste. Since a shell script exits with
the status of the last command executed, and the exit value
of ":" is always 0, "exit 0" and ": exit 0" at the end of
a shell script are functionally equivalent.
I tend to use ": exit 0" at the end of a .sh script because
the .sh scripts are sourced, and exit 0 might also exit the
calling shell script. ": exit 0" just makes that more
explicit.
Since /etc/init.d/rc call the .sh shell scripts in a
seperate environment using ( .. ) this cannot happen, so
I could just use "exit 0" (or no exit at all), but still,
it doesn't really matter.
Mike.