coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: basename BSD compatibility and filter mode


From: Jérémy Compostella
Subject: Re: basename BSD compatibility and filter mode
Date: Sun, 4 Mar 2012 20:09:43 +0100

> [...]
> I just logged onto an OS X box there and you're right:
>
> $ printf "%s\n" 1/1 2/2 | xargs basename
> 1
>
> $ printf "%s\n" 1/1 2/2 3/3| xargs basename
> 1
> 2
> 3
>
> However I think it's dangerous to do that.
> If I was writing a script I would probably test with
> 1 or 3 or more arguments. But the script would then fail if
> given 2 args based on transient conditions.
> I would not emulate that "feature".
I do agree it's dangerous. I removed this "feature".

> > [...]
> > Eric Blake said:
> >> It's been brought up before, and the consensus has always been that if
> >> someone would write the patches, it would be worthwhile.  We do need
> >> support for a -0 or some other way to do NUL-terminated filtering,
> >> though.
> > which conflict with the idea that this feature is not really worth. I'm
> > a bit confused now ...
>
> Yes, I agreed with Eric that -0 was useful,
> but on consideration if not processing stdin,
> then I don't think it's of use.
OK.

I attached the patch. Feel free to comment.

BTW, dirname suffers the same limitation I propose to add the BSD
options support too to this command. What do you think?

Cheers,

Jérémy

Attachment: 0001-basename-add-BSD-options-support.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]