[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] boot script



Peter Slegg, 13.05.2013 19:20:14:


Can someone tell me why this sh script doesn't behave how
I expect it to when the partition doesn't exist ?


    for drv in $ext2drives; do
        echo; echo "Checking filesystem on drive $drv."
        fsck.ext2 -p -C - $drv:
        if [ $? -ge 2 ]; then
            echo
            echo "Warning: e2fsck FAILED ($?)"


What I see is:

    Warning: e2fsck FAILED (0)

Shouldn't the $? -ge 2 mean that the error numbers below 2
are not shown ?

Try that:

       for drv in $ext2drives; do
           echo; echo "Checking filesystem on drive $drv."
           fsck.ext2 -p -C - $drv:
           if [ $? -ge 2 ]; then
	     r=$?
               echo
               echo "Warning: e2fsck FAILED ($r)"

The $? is updated by echo. Also fi and done are missing, but I guess you
didn't post the complete script.


--
Helmut Karlowski