I can not get the return code from mtree to control
the displaying of a error message.

The mtree at the end of the script does function correctly
because I can tell from the printed output.

When mtree prints comments saying "extra" that means the directory being read does not match the specification file. return code should be Not equal to zero.

And when they do match IE: no mtree comments printed, that should be a return code of zero.

I tried 2 different ways to capture the return code to no joy.
What I am doing wrong?

#! /bin/sh
flavor="/a/mtree.std"
echo "flavor = ${flavor}"
/bin/cat  << EOF |
/set type=dir uname=root gname=wheel
.
etc     ignore
..
root    ignore
..
usr
home    ignore
..
local
etc     ignore
..
..
..
..
EOF

 mtree -d -u -p "${flavor}"  || \
   echo "Error invalid directories in flavor ${flavor}."

#mtree -d -p "${flavor}"
#[ $? -eq 0 ] || \
#  echo "Error invalid directories in flavor ${flavor}."
echo "return = $?"


_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to