Patch for cp(1)
Bruce Evans
bde at zeta.org.au
Sat Apr 2 23:52:46 PST 2005
On Sat, 2 Apr 2005, David Schultz wrote:
> On Sat, Apr 02, 2005, Bruce Evans wrote:
>> On Fri, 1 Apr 2005, David Schultz wrote:
>>> Furthermore, are there situations where -r and -R differ such that
>>> -r would behave reasonably? If it's the case that every time
>>
>> As I said, the main case where cp -r gives useful behaviour is for
>> symlinks, where you actually want to follow symlinks but don't know
>> about cp -RL.
>
> As (I think) Tom meant to suggest in his last message, -r could be
> made an alias for -RL. That would result in behavior less
> surprising than to most people than either -r's current behavior
> or removing -r entirely. Do you agree?
I would be happy with that. Maybe people who want -r to be the same as
-R wouldn't be.
>> BTW, there are several utilities whose support for tree walks is deficient
>> due to their only having a -r flag and not having caught up with the 13+
>> year old -RHLP flags. diff is the most important one.
>
> What I really want is a grep -R that understands how to skip
> special files. Actually, grep -R already exists, but it's just an
> alias for -r.
Hmm, -[rR] is even more tangled and broken for grep than for cp. The
tangled history is:
- wosch added -R in 1996 in grep.c 1.5. ISTR complaining that it wasn't
accompanied by [HLP].
- gnu added -r, and we merged the changes in grep.c 1.14.
- -R was lost in grep.c 1.14 and restored as an alias for -r in 1.15.
So we now have -R == -r, and can't fix -R without adding a new option.
While I'm wishing for utilities to handle links correctly, I'll wish
for a zgrep thet can skip all hard links except the first in
"zgrep -r foo /usr/share/man".
> You have to say 'grep -D skip -R', which I never
> remember until I've drummed my fingers on the keyboard for a while
> waiting for grep to finish. Actually, I think I'll go make an
> alias now...
I didn't know about grep -D.
Bruce
More information about the freebsd-standards
mailing list