bug-bash
[Top][All Lists]
Advanced

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

Re: exit status issue


From: Bob Proulx
Subject: Re: exit status issue
Date: Fri, 18 Nov 2011 12:59:12 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

Dallas Clement wrote:
> Geir Hauge wrote:
> > Add ''set -x'' at the start of the function and examine the output
> > to see if it actually runs touch from PATH.
> 
> The strace output is showing that the correct 'touch' is being executed.

It would be a lot easier to use the 'sh -x' trace than using strace
for seeing what is going on in your script.  Try it first and see
commands are being run.  Because you are setting CHK_RESULT=1 as a
default all that it would take for your script to exit 1 would be to
not be setting that value to zero at a time that you think it should.

  sh -x ./scripttodebug

Your script is complicated enough that it isn't immediately obvious by
a casual inspection whether it is correct or not.  Almost certainly in
these cases it is an error in the programming of the script.  I would
much sooner suspect it than bash at this point.

>        TMP=`grep $1 /proc/mounts|awk '{print $1}'`

You do not show how this is called but $1 option argument to grep may
be insufficiently quoted.

>    echo "*** fsaccesstest failed to unmount $1. ***" >/dev/console

Writing directly to /dev/console is a little harsh.  You might
consider using the 'logger' program and writing to the syslog instead.

Your script makes me think that you might be using an NFS automounter
and trying to correct nfs client problems.  (shrug)

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]