coreutils
[Top][All Lists]
Advanced

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

Re: split: support unlimited number of split files


From: Pádraig Brady
Subject: Re: split: support unlimited number of split files
Date: Sat, 10 Mar 2012 17:05:05 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0

On 03/10/2012 02:25 PM, Jérémy Compostella wrote:
> 2012/3/10 Pádraig Brady <address@hidden>:
>> On 03/10/2012 11:13 AM, Jérémy Compostella wrote:
>>
>>> BTW, reviewing your changes I discovered that when a user specifies a
>>> suffix length zero the old behavior was to use the default length of 2
>>> and the new is, of course, the suffix auto length way.
>>
>> Well spotted. I noticed that too, but thought 0 = auto (default) was ok.
>>
>>> However, IMHO,
>>> it's dangerous to not raise an error. If a user for example make a
>>> script which use split with a shell variable for the suffix_length
>>> option it could have the feeling that his script works fine although it
>>> provides a suffix length zero.
>>
>> Though if there was an existing script as follows we'd break it.
>>
>> sl=0 #default
>> [ "$some_condition" ] && sl=5
>> split -a $sl ...
>>
>>> I attached an independent patch since there is no semantic relationship
>>> with the current one. Feel free to merge, review or refuse it.
>>
>> I'm inclined to think this is fine as is.
> OK. I do agree with your argumentation. However, an error for an
> inconsistent argument value does not always need a documentation, but
> IMHO, an implicit feature like this should be documented, no ?

Agreed. Also -d needed some extra info.

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 154bcfe..f9207e7 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -3088,7 +3088,11 @@ and so can be a pipe for example.
 @itemx --suffix-length=@var{length}
 @opindex -a
 @opindex --suffix-length
-Use suffixes of length @var{length}.  The default @var{length} is 2.
+Use suffixes of length @var{length}.  If a @var{length} of 0 is specified,
+this is the same as if (any previous) @option{-a} was not specified, and
+thus enables the default behavior, which starts the suffix length at 2,
+and unless @option{-n} or @option{--numeric-suffixes=@var{from}} are
+specified, will auto increase the length by 2 as required.

 @item -d
 @itemx --numeric-suffixes[=@var{from}]
@@ -3096,6 +3100,9 @@ Use suffixes of length @var{length}.  The default @var{len
 @opindex --numeric-suffixes
 Use digits in suffixes rather than lower-case letters.  The numerical
 suffix counts from @var{from} if specified, 0 otherwise.
+Note specifying a @var{from} value also disables the default
+auto suffix length expansion described above, and so you may also
+want to specify @option{-a} to allow suffixes beyond @samp{99}.

 @itemx --additional-suffix=@var{suffix}
 @opindex --additional-suffix

cheers,
Pádraig.



reply via email to

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