ubuntu 9.10 if you type rm you get a missing operand error, same thing with rm -r but rm -f yields no error. -f is supposed to be 'force' not 'dispell errors'
|
feedback
|
|
From the Unix manpage
ignoring nonexistant files means that there will be no error if there is no files to remove, which is what happens when you use rm -f with no file(s) specified. This is the expected behavior as far as I know. It does not ignore all errors, but -f does not require the file to be listed an operand, so there is no error to throw. | |||||||||||||||||||
feedback
|
|
SUSv3 says:
| |||
|
feedback
|
|
To understand why the file parameter is really optional, you have to consider that in many scripts the list of files to remove is stored in a variable and using -f allows you to not care whether the list is empty or not. You can simply do:
insead of the more cumbersome:
So it's logical that an option called "ignore nonexistent files" does not fail when no file is given on the command line. | |||||
feedback
|