Alexander Leidinger <[EMAIL PROTECTED]> 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 - [EMAIL PROTECTED]
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to