According to the chflags(1) manual page, the -f argument should prevent chflags from printing any message to stderr and from modifying its exit status. However, when called with a a pattern not delivering any files, chflags will still exit with status 1 and print "chflags: No match." to stderr. This behaviour can be reproduced: #~ mkdir test #~ /bin/chflags -f noschg test/* chflags: No match. #~ echo $? 1 Suggested fix: Either change behaviour of chflags to silently exit with status 0 when an empty set of files is supplied (if called with the -f flag, of course) - or update man page to document the current behaviour correctly.
The error message ("No match") you get is from tcsh. It happens before chflags is started, so chflags cannot do anything about it. With sh, the error message is: chflags: /var/empty/*: No such file or directory A command like chflags -f noschg / correctly prints no error message and returns exit status 0, however. To me, the text in the man page -f Do not display a diagnostic message if chflags could not modify the flags for file, nor modify the exit status to reflect such failures. seems to match the behaviour I see: only failures to modify flags are suppressed, while failures to locate files are unaffected. This matches chmod's -f option, but that option is not standard either.