sh script problem with capturing return code

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Wed Jan 9 20:55:41 UTC 2013


Lowell Gilbert <freebsd-questions-local at be-well.ilk.org> writes:

> It's not; ignore my example. The extra directory was under the ignored
> directory, so it's testing the right properties. I think if I create the
> new subdirectory under the other main directory, it would be right.

Confirmed. The test case now looks like this:
================================================================
mkdir etc home
mtree -c -d > ../out
mtree -d < ../out
echo $?
echo "That was the first: should be 0."
mkdir etc/temp
mtree -u -d < ../out
echo $?
echo "That was the second: should be 2."
sed -i ""  's/^\(home[ ]*\)\(.*\)$/\1ignore/' ../out
mtree -d < ../out
echo $?
echo "That was the third: should be 0."
================================================================

I think it's a real bug, and the test cases don't cover "extra" elements
at all. Now I just have to figure out the right fix.


More information about the freebsd-questions mailing list