4 ms·
I know its only an example but why yes | rm -r <> and not rm -rf <>
by teapot01 9y ago
I know its only an example but why
yes | rm -r <>
and not
rm -rf <>
- x1798DE 9y agoI think rm -rf would also suppress errors in addition to confirmation messages, so presumably if you want a "soft" force...
- eridius 9y agoNo it doesn't. > rm -rf foo/bar rm: foo/bar: Permission denied
- mnarayan01 9y agoIf foo/bar does not exist, it should be silent. Via http://pubs.opengroup.org/onlinepubs/007904975/utilities/rm.html http://pubs.opengroup.org/onlinepubs/007904975/utilities/rm.... on the -f option: > [...] Do not write diagnostic messages or modify the exit status in the case of nonexistent operands. [...]
- eridius 9y agoYes, but that's the only error it suppresses, and that's because "not existing" isn't really an error for a tool that's trying to delete something. In my example foo/bar existed but I didn't have permissions to delete it, and as you'll see it printed out that error.
- mooktakim 9y agoI believe "yes" has become less useful over the years, with flags like force and quiet solves this now.