bug-coreutils
[Top][All Lists]
Advanced

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

bug#27128: fold -b wants no immediate space, otherwise mistakes number a


From: Pádraig Brady
Subject: bug#27128: fold -b wants no immediate space, otherwise mistakes number as filename
Date: Mon, 29 May 2017 12:31:13 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

tag 27128 notabug
close 27128
stop

On 29/05/17 08:42, davidpbrown wrote:
> coreutils v 8.25-2ubuntu2
> 
> fold -b error wanting no space before the number, inconsistent with
> expectation and -w
> 
> 
> Error:
> 
> $ echo "abcdefghijklm"  | fold -b 6
> fold: 6: No such file or directory
> 
> 
> inconsistent with -w
> 
> $ echo "abcdefghijklm"  | fold -w6
> abcdef
> ghijkl
> m
> 
> $ echo "abcdefghijklm"  | fold -w 6
> abcdef
> ghijkl
> m
> 
> 
> but works with:
> 
> $ echo "abcdefghijklm"  | fold -b6
> abcdef
> ghijkl
> m

What's happening here is that fold(1) supports arguments
of the form `fold -80`. That's undocumented
since it's legacy and supported only for compat with old scripts.
Therefore -b6 is equivalent to -b -6 which is supported:

$ echo "abcdefghijklm"  | src/fold -b -6
abcdef
ghijkl
m

The documented form for what you want to do is:

echo "abcdefghijklm"  | src/fold -b -w6
abcdef
ghijkl
m

thanks,
Pádraig





reply via email to

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