On Fri, Nov 18, 2011 at 2:59 PM, Bob Proulx <[email protected]> wrote: > 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 > >
I'm guessing you mean bash -x, not sh -x. Two different shells.
