GNU bug report logs -
#21356
BUG: split shorter version of '--numeric-suffixes' give error
Previous Next
Full log
Message #11 received at 21356 <at> debbugs.gnu.org (full text, mbox):
2015-08-27 00:05:49 +0100, Pádraig Brady:
[...]
> > $ split -n10 -a4 -d5 echo.txt
> > split: cannot split in more than one way
> > Try 'split --help' for more information.
> >
> > where as using longer option for `-d` i.e. `--numeric-suffixes` works fine.
> >
> > $ split -n10 -a4 --numeric-suffixes=5 echo.txt
> >
> >
> > FYI: I had asked it on unix.stackexchange as well, for reference http://unix.stackexchange.com/q/225704/17265
>
> -d can't take an _optional_ argument for backwards compat
> and operational reasons. I.E. generally short options
> can't take an optional argument due to ambiguities that would introduce.
>
> The particular ambiguity in this case is that -d5 is equivalent
> to -d -5, which is equivalent to -d -l5, hence the error.
[...]
Note that GNU getopt supports short options with optional
arguments (though doesn't allow an empty argument like the long
option version).
The split documentation could be improved to avoid this kind of
confusion:
info page:
`-l LINES'
`--lines=LINES'
Put LINES lines of INPUT into each output file.
For compatibility `split' also supports an obsolete option syntax
`-LINES'. New scripts should use `-l LINES' instead.
[...]
`-d'
`--numeric-suffixes[=FROM]'
Use digits in suffixes rather than lower-case letters. The
numerical suffix counts from FROM if specified, 0 otherwise. Note
specifying a FROM value also disables the default auto suffix
length expansion described above, and so you may also want to
specify `-a' to allow suffixes beyond `99'.
It's easy to miss that it's not `-d[FROM]` here. A note along
these lines could help:
"Note that the FROM value can only be specified with the long
option from."
For the --help output (in English at least), the distinction
doesn't appear:
-d, --numeric-suffixes[=FROM] use numeric suffixes instead of alphabetic.
FROM changes the start value (default 0).
[...]
-l, --lines=NUMBER put NUMBER lines per output file
Can't tell from that that -d5 wouldn't work.
--
Stephane
This bug report was last modified 6 years and 263 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.