On 12/17/11 4:36 PM, Mouse wrote:
Well, that and
the fact that getting "rm" (or del) to behave the way
I suggest actually requires low-level changes to the shell's wildcard
expansion
Yes.
(*and* thus would require a change to all all
tools)
No.
There is no reason this couldn't be done by expanding wildcards as
normal, but providing some way - which doesn't affect tools that don't
choose to call it - for a program to get hold of its pre-globbing
arglist, if its execer provided one.
I hesitate to get into this discussion.
Not only is there no reason it can't be done - for a program to have
its own list of wildcards - but it has been done, and it's common.
Simply write the regular expressions into the command itself.
Running "grep" in a bash shell, for example, involves 2 levels of
wildcard. The shell's '?' and '*', and then grep's own list of
regular
expressions, which includes the wildcards '.' and '.*'.
Then rm could use the new facility to see if any args
were "*", or if
there was only one arg and it's "*", or whatever. Programs that don't
know about the new way or don't want to muck with it continue to work
the way they always have. Of course it would need to be designed
carefully so that execers that don't know about it don't break programs
that try to use it, but that's doable.
Using grep as an example again, one must escape special characters to
be evaluated by grep so that the shell doesn't parse them, but it's very
simple to do so. *IFF* you understand what both the shell and grep are
doing.
Doc