coreutils
[Top][All Lists]
Advanced

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

Re: [coreutils] basename/dirname can't handle stdin?


From: Eric Blake
Subject: Re: [coreutils] basename/dirname can't handle stdin?
Date: Thu, 13 Jan 2011 08:08:01 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7

On 01/13/2011 07:59 AM, Philipp Thomas wrote:
> * Jim Meyering (address@hidden) [20110113 08:53]:
> 
>>> * Add --suffix [suffix] to enable suffix killing (using
>>>   SUFFIX as the 2nd arg will no longer work going forward)
> 
> Using SUFFIX as the second argument IMO has to keep working as otherwise
> you'll break tons of scripts!

That's the whole point of the BSD -a/-s options, and extensible to our
proposal for --files0-from.

basename str1 str2: POSIX behavior (str2 is suffix)
basename -a str1 str2: filter behavior, print basenames of both str1 and
str2 without suffix
basename -s suffix: filter mode, reads from stdin, and chops suffix
basename: filter mode, reads from stdin
basename -s str2 str1: explicit suffix, same as basename str1 str2
basename -s suffix str1 str2: filter behavior, print basenames of both
str1 and str2 without suffix
basename -a -s suffix str1 str2: same (-a is only required for exactly
two arguements, and is implied for 0 or for more than 2 args)
basename --files0-from=file -s suffix: filter mode, input is NUL rather
than newline terminated, so output is NUL terminated as well

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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