Date: Wed, 09 Jan 2013 15:00:32 -0500 From: Lowell Gilbert <freebsd-questions-local@be-well.ilk.org> To: Fbsd8 <fbsd8@a1poweruser.com> Cc: FreeBSD questions <questions@freebsd.org> Subject: Re: sh script problem with capturing return code Message-ID: <448v82unxb.fsf@lowell-desk.lan> In-Reply-To: <50ED88CF.7060308@a1poweruser.com> (fbsd8@a1poweruser.com's message of "Wed, 09 Jan 2013 10:12:15 -0500") References: <50EC9009.3030305@a1poweruser.com> <20130108224626.8c2d89cd.freebsd@edvax.de> <50EC99F2.3020404@a1poweruser.com> <44d2xevlhb.fsf@lowell-desk.lan> <50ED88CF.7060308@a1poweruser.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Fbsd8 <fbsd8@a1poweruser.com> writes: > So the question remains, why is mtree giving a return of zero when it > finds directories on the target that are not in the spec file? Okay, I had a hard time figuring out your examples, but I think I've got an independent repeatable test case for the problem. ================================================================ mkdir etc home mtree -c -d > ../out mtree -d < ../out echo $? mkdir home/temp mtree -d < ../out echo $? sed -i "" 's/^\(home[ ]*\)\(.*\)$/\1ignore/' ../out mtree -d < ../out echo $? ================================================================ The results are: ================================================================ 5045] (lowell-desk) temp> mkdir etc home [5046] (lowell-desk) temp> mtree -c -d > ../out [5047] (lowell-desk) temp> mtree -d < ../out [5048] (lowell-desk) temp> echo $? 0 [5049] (lowell-desk) temp> mkdir home/temp [5050] (lowell-desk) temp> mtree -d < ../out home/temp extra [5051] (lowell-desk) temp> echo $? 0 [5052] (lowell-desk) temp> sed -i "" 's/^\(home[ ]*\)\(.*\)$/\1ignore/' ../out [5053] (lowell-desk) temp> mtree -d < ../out [5054] (lowell-desk) temp> echo $? 0 ================================================================ and I think the problem you're having is that the second "echo $?" should be 2, although the others are correct at 0. Is that correct? One difference from your example is that you're using '-u'. I'm not sure why you're doing that, but it doesn't affect the bug. Yours, Lowell -- http://be-well.ilk.org/~lowell/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?448v82unxb.fsf>