23.10 Deletion with Prejudice: rm -fThe -f option to rm is the extreme opposite of -i ( 21.11 ) . It says, "Just delete the file; don't ask me any questions." The "f" stands (allegedly) for "force," but this isn't quite right. rm -f won't force the deletion of something that you aren't allowed to delete. (To understand what you're allowed to delete, you need to understand file access permissions ( 22.2 ) .) What, then, does rm -f do, and why would you want to use it?
I find that I rarely use rm -f on the UNIX command line, but I almost always use it within shell scripts. In a shell script, you (probably) don't want to be interrupted by lots of prompts should rm find a bunch of read-only files. [You probably also don't want to be interrupted if rm -f tries to delete files that don't exist because the script never created them. In some UNIXes, rm -f will give an error here; in others, it won't. -JP ] - |
|