cvs commit: src Makefile.inc1
Dag-Erling Smørgrav
des at des.no
Wed May 16 08:18:45 UTC 2007
Alexander Leidinger <Alexander at Leidinger.net> writes:
> What about another idea: removing the chflags all together and let the
> removal fail (with a message that the file may be protected with schg
> and it should be removed with chglags). This way only a message
> appears when the rm fails (saying no to the removal question of rm is
> not a failure/exit!=0).
OK with me.
BTW, testing for the schg flag is not straightforward, but doable:
flags=$(stat -f '%f' ./$${file})
if [ $((flags & 131072)) -eq 131072 ] ; then
# schg is set
fi
Another possibility is
if (ls -lo ./$${file} | grep -qw schg) ; then
# schg is set
fi
but it's not 100% foolproof, as the file name itself or the owner /
group might conceivably contain the word "schg".
DES
--
Dag-Erling Smørgrav - des at des.no
More information about the cvs-src
mailing list