GNU bug report logs - #49217
'shuf' returns nothing if the low range number is higher by 1 than the high number

Previous Next

Package: coreutils;

Reported by: F8ER F8ER <the.f8er <at> gmail.com>

Date: Fri, 25 Jun 2021 04:14:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #19 received at 49217 <at> debbugs.gnu.org (full text, mbox):

From: Erik Auerswald <auerswal <at> unix-ag.uni-kl.de>
To: 49217 <at> debbugs.gnu.org
Subject: Re: bug#49217: 'shuf' returns nothing if the low range number is
 higher by 1 than the high number
Date: Fri, 25 Jun 2021 08:54:43 +0200
Hi,

On Fri, Jun 25, 2021 at 08:49:51AM +0200, Erik Auerswald wrote:
> On Thu, Jun 24, 2021 at 09:19:36PM -0700, Paul Eggert wrote:
> > On 6/24/21 4:46 PM, F8ER F8ER wrote:
> > >For example, `shuf -i 101-100 -n 1` returns nothing with the exit code
> > >= 0 (unexpected).
> > 
> > Actually, it's the expected behavior. It's the same behavior as
> > 'shuf -n 1 </dev/null'. The '-n 1' option does not mean "output
> > exactly 1 line"; it means "output at most 1 line".
> 
> I think the reported issue is with producing no error with LO==HI+1,
> but producing an error with LO<HI+1:
                                ^
                              LO>HI+1

Sorry!

Thanks,
Erik
-- 
Hofstadter's Law: It always takes longer than you expect, even when
                  you take into account Hofstadter's Law.




This bug report was last modified 3 years and 326 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.