Globbing
Bill Hacker
wbh at conducive.org
Fri Feb 15 05:56:10 PST 2008
Oliver Fromme wrote:
Simon 'corecode' Schubert wrote:
> Oliver Fromme wrote:
*snip* good stuff, in archives if need...
I has said I'd wiki-fy this but since it contines here ..
what I had in mind is simple, and two-fold:
First, that the use of a naked '*' as in either;
rm *
or
rm -Rf *
. . will both always be special cases of 'globbing', as neither pattern
matching nor list-building is actually needed.
All we want done is to zero-out the entries, much as if we were
newfs'ing a subdir instead of a partition.
Code that could recognize that special case and act accordingly should
be blitzen fast and need very little in the way of wall-clock time, I/O
or CPU resources. As said earlier, it just bitch-slaps the inode(s) into
amnesia.
Second, in the more general case of complex pattern matching:
I'd want to add a command-tail switch that told rm (and friends) to drop
into a repetitive batch mode, wherein the 'chunk' size presumed
longest-possible file names, queried the environment w/r buffer size,
and operated on no more than the number of entries at a time than could
be expected to fit into, say half the known/expected resource set.
A brand-new switch does not interfere with any legacy behaviour - which,
as we have seen, *must* be preserved.
Now - I expect that this would be *slower* than many/all of the 'xargs'
and similar options so far cited - and that an expert would usually
elect to utilize any of the several other methods.
No problem with that. Nothing has gone away.
But - slow or not, and keeping in mind how downright deadly 'rm' can be
in *any* form, I don't see it as any MORE dangerous than any other method.
Au contraire - slow or not, it should be less subject to keying or
'headspace' error than is opened up in the other parts of the scripts so
far submitted. The more characters, the greater the chance of error.
But just what the Doctor ordered for busy admins who need to do this too
seldom to want to wander off into interpreters OR clever scripts...
IOW - BFBI approach. Brute Force and Bloody Ignorance. It JFW.
Unreasonable? Perhaps.
But Google 'progress and unreasonable'
Best,
Bill
More information about the Kernel
mailing list