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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -