Yes GNU spends a lot of time improving performance. A couple of examples from the most recent release, which you might think were too simple to optimize significantly:
The yes command (which is generally useful for generating repetitive text):
The chmod gotcha that I hit occasionally when I haven't used the chmod command for a while is the difference between "chmod -R <perm> <dir>" which recurses as would be expected and "chmod -r <perm> <dir>" which interprets "-r" as the <perm> spec, complains that the file <perm> doesn't exist, then removes read permission from <dir>.
I ended up writing my own version of basename and dirname that acted as both filters and commands. Its actually not that hard given the functions you have (might give it another go given the whole pledge thing just to see how it would work). URL versions of these commands are also very useful and not too hard to program in perl.
Can you give an example where I have a file (a.txt) of 100 file names and need the basename of each? I'm pretty sure dvh just used echo to show a simple example, not an actual use.
The yes command (which is generally useful for generating repetitive text):
Details on that fairly simple change are at http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h...Also we more than doubled the speed of wc -l (by avoiding function call overhead):
Also we now generate an infinite stream of integers more efficiently too:At any rate, removing list permissions from directories is probably not what you want to do.
That find even have actions are one of those big unix oddities.
Summary of that is you can filter using xargs like:
No point having two ways to do something, especially when there are caveats about enabling stdin processingBecause a lot of people have use for a filter version
> It doesn't act as a filter, processing a stream of data, but rather as a plain function.
That's the problem with a lot commands, some work as filters, some as simple commands, and other do both. The reasoning on the decision is confusing.
[edit: yes, combining with xargs will often work]
Can you give an example where I have a file (a.txt) of 100 file names and need the basename of each? I'm pretty sure dvh just used echo to show a simple example, not an actual use.