4 ms·
> Unix is centred around composing lots of individual tools that do one job well. By this standard, the Unix philosophy has never been realized. Even when the
by MichaelCollins 4y ago
> Unix is centred around composing lots of individual tools that do one job well.
By this standard, the Unix philosophy has never been realized.
Even when the tools work as advertised, they're hardly doing it well. How do you delete a file called -foo? `rm -- -foo`. Do you know what -- is? It's kludge! It's kludge that needs to exist because Unix's entire paradigm of argument passing is legacy crap.
And historically, the tools didn't even work as advertised. Before GNU came along, there used to be all kinds of hidden landmines in common Unix utilities, like tools which silently truncated long output lines because they were using static buffers instead of dynamic memory allocation. GNU's style guide specifically warns against doing this, because it used to be the Unix status quo. Things like this get left out of the romantic tales of Unix's history, leading newbies to view Unix with rose tinted glasses.
As for "doing one thing", nobody even knows what that means. What is the difference between one thing and two things? Should rm not be able to remove directories because rmdir exists? That's subjective, what qualifies as "one thing" is inherently subjective.
- legends2k 4y agoThanks for your answer. Never realised the overlap between rm and rmdir. Actually the philosophy is a nice guideline but blindly holding on to it for the heck of it is childish. Your comment made me realise that.
- gw98 4y agoOh completely agree. But the philosophy is spot on. I've applied it to many problems over the years successfully outside the domain of Unix. The reality is however less than ideal.
- b112 4y agoAgree, but don't like your rm example. rm -- just means end of args, and it can conveniently be left off. That's not a kludge, it's a feature. A feature that many command line utils (GNU grep) support.
- legends2k 4y agoIt's kludge since you are special casing for some files and not for others e.g. rm abc vs rm -- -xyz. If Unix utilities had a different form of specifying args which didn't meddle/overlap with file names this kludge wouldn't have to exist.
- b112 4y agoBut it isn't a kludge, you are supposed to use it for all files, you are just granted the option of not.
- sgbeal 4y ago> How do you delete a file called -foo? rm ./-foo