linux - Why do many init.d scripts end in "exit $?"? -
i've seen lot of strange quirks in centos 6.5's init.d scripts, 1 pattern i've seen at end of of these scripts is
case "$1" in # ... commands here esac exit $?
what purpose of "exit $?
" here?
it makes script return return code of last significant command calling init system. whenever command exits, return code stored on $?
shell.
it's not necessary explicitly specify $?
scripters include clear intends do.
exit: exit [n]
exit shell.
exits shell status of n. if n omitted, exit status of last command executed.
i hope don't mean eend $?
of openrc
:
eend retval [string ]
if retval not equal 0 output string using eerror , !! in square > brackets @ end of line. otherwise output ok in square brackets @ end of line. value of retval returned.
see source.
Comments
Post a Comment