Hi again. On Fri, Nov 06, 2015 at 03:01:08PM +0100, Peter Palfrader wrote: [...] > But it should work. > > An "exit 0" at the end, or a "if [ -d ... ]; then rmdir .. ; fi" would > also work instead and might be preferable.
Please stop suggesting exit 0. It does not work. Hopefully the attached minimal testcase will convince you of this. The final "exit 0" will simply never be reached. run: ./foo.sh && echo $? (Try also replace 'false' with 'false && true' to more exactly simulate your particular bug case.) (... and even if it was reached, that would certainly throw away any exit code - not just the rmdir one.) rmdir failing is not the end of the world anyway, it's just a "lets be nice and clean up if we can" kind of thing. In your very obscure case that noone else triggered so far there is no directory to clean up anyway, so don't worry! :P Regards, Andreas Henriksson
foo.sh
Description: Bourne shell script