Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jun 2002 20:20:18 -0400
From:      parv <parv@pair.com>
To:        Frank v Waveren <fvw@var.cx>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: bin/39198: sh aborts on variables with periods
Message-ID:  <20020613002018.GA38200@moo.holy.cow>
In-Reply-To: <1023918173HKC.fvw@yendor.var.cx>
References:  <200206122010.g5CKA3L09165@freefall.freebsd.org> <20020612214110.GA30199@moo.holy.cow> <1023918173HKC.fvw@yendor.var.cx>

next in thread | previous in thread | raw e-mail | index | archive | help

in message <1023918173HKC.fvw@yendor.var.cx>,
wrote Frank v Waveren thusly...
>
> On Wed, Jun 12, 2002 at 05:41:11PM -0400, parv wrote:
> >     if test $RANDOM = $RANDOM
>
> omg, you wicked wicked man. That will mysteriously misdetect on ksh/bash
> once in 32767 times. Please don't.

oh, come on, i am merely conveying what i got in the mail!


anyway, i tried...

i=0

while [ $i -le 32767 ]
do
  echo -n $i' '

  if [ $RANDOM = $RANDOM ]
  then
    echo same
  else
    echo diff
  fi

  i=$(( $i + 1 ))
done

...the above more than three times each in bash-2.05 &
ksh93-20020317 (i.e. more than 3 * 2 * 2^16 times) and did not get
any utterance of 'same'.  not that that proves anything...


-- 
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020613002018.GA38200>