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
The alternative to do-one-thing is do-lots-of-things.
You describe a need for all-singing, all-dancing solutions over single use tools.
You know there are colors beyond black and white? There’s a spectrum of alternatives.
I’m arguing for a little more singing and a little more dancing well-integrated solutions. Like the
-deleteparameter to thefindtool is the step in the right direction. Or do you think that this parameter is superfluous and good oldrmis perfectly fine?You're gonna think I'm a asshole but, chaining find and rm seems like the best way because you get to keep all the options of rm instead of having only the less flexible option of -deleting every match.
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.