?

Log in

No account? Create an account

Wed, Aug. 31st, 2005, 01:20 pm
exit codes in bash

Spot what's wrong with this shell script

    ./somecommand
    if [ $? -ne 0 ]; then
        exit $?
    fi

Got it? It will always exit with a code of 0 because the if statement is actually a command. Doh.