> On December 09, 2007 at 04:19PM Micah Cowan wrote:

> I believe I already answered this: it is because a non-zero exit status
> always means "something's wrong". Myriad scripts invoke utilities in
> ways similar to:
> 
> if ! wget http://foo.com/
> then
>   echo "Something went wrong with the download."
> fi

<snippet>

wget http://foo.com
EC=$?
case $EC in
    [0])
    bla bla bla
    ;;
    [1])
    bla bla bla
    ;;
    *)
    more bla
    ;;
    esac

A very simple way to handle an exit code. Place the entire code into a
function and it can be used anywhere in the script.

> If Wget starts using non-zero to mean a "special" kind of success,
> scripting suddenly becomes much more complicated (and Wget suddenly
> ceases to be "Unixy").

The terminology here is incorrect. This is not a special kind of success. It
is simply exiting with a specific code defining what has transpired. This
makes scripting far easier. not more difficult.


-- 
Gerard

Reply via email to