39
The Unix way and integration complexity
(feddit.org)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
Have you considered the reasons this option was added despite this seemingly obvious fact?
For the single case where a user wants to find then delete a bunch of files, the --delete flag makes sense, but having the function of find overlap with the function of rm adds complexity to the codebase of find without matching the feature set of find + rm.
Remember how I was saying that good integration is difficult? Well, if you just "naively" integrate with
rmthen you get issues like "too many parameters passed to rm" or "there is a vulnerability if you manipulate filesystem while find is still running". These are among the reasons a well-integrated-deleteexists, as "impure" and "complex" as it is.man find tells me that you should be using the -exec flag should be used if you want to do some operation on the files you find one at a time, using man to learn about a tool before you use it is also the Unix Way. (It also mentions the --delete flag as well as the gotchas that come along with using it).
I will agree that for some complicated tasks that a lot of users might want to do a lot of times, for example downloading videos from YouTube, all encompassing tools are are good idea. yt-dlp has hundreds of functions to cover all the things a user might want to do, but even it relies on outside tools like ffmpeg to get the job done.
You actually support my point by referring to manuals. The manual for find is more that thousand lines of text. Should I read it before first use and memorize all the peculiarities forever? Or should I check it every time I use find to see if there are comments specific to the current scenario? Both alternatives seem complex. Remember how I am complaining about unnecessary complexity? When using an alternative in a programming language I don’t have to bother with all that: I get a file handle and pass it to delete method.
Many commenters on the internet say "you should read the manual". I doubt they follow this advice. I won’t take you as an example because you claimed no expertise. But whenever someone says these words, ask them to compare
find -deleteandfind rmwithout looking into manual, see what they say.