Devin Teske <dte...@vicor.com> writes: >>> ############################################################ GLOBALS >>> >>> # Global exit status variables >>> : ${SUCCESS:=0} >>> : ${FAILURE:=1} >> >> Should this really be set to something other than 0 or 1 by the >> end-user's environment? This would simplify a lot of return/exit >> calls... > > A scenario that I envision that almost never arises, but... > > Say someone wanted to call my script but wanted to mask it to always return > with success (why? I dunno... it's conceivable though). > > Example: (this should be considered ugly -- because it is) > > FAILURE=0 && sysrc foo && reboot
Wouldn't this bork functions used inside a conditional? : ${FAILURE:=1} foo() { return ${FAILURE-1}; } if ! foo; then echo good else echo error fi $ test.sh good $ FAILURE=0 test.sh error I think only sysrc_set() is affected, though. if sysrc_set "$NAME" "${1#*=}"; then echo " -> $( sysrc "$NAME" )" fi $ sysrc hostname=blah hostname: raphael.local sysrc: cannot create /etc/rc.conf: permission denied $ FAILURE=0 sh sysrc hostname=blah hostname: raphael.local sysrc: cannot create /etc/rc.conf: permission denied -> raphael.local _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"