tech-userlevel archive

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

Re: randomness (crypto?) code example wanted please?



At Sun, 25 Jun 2017 15:21:54 +0700, Robert Elz <kre%munnari.OZ.AU@localhost> wrote:
Subject: randomness (crypto?) code example wanted please?
> 
> I am (sometime not to far away) planning to add $RANDOM to
> the NetBSD shell (for !SMALL shells so not for install media) - part
> of keeping up with the Jones's, as just about every other shell has it,
> even our /bin/ksh.

For what it is worth I've been using the likes of:

	if [ ${RANDOM:-0} -ne ${RANDOM:-0} ] ; then
		: is some kind of ksh variant or clone
	fi

since I first encountered ksh, probably in the mid 1980s (I have
references to using ksh-85 in my dot files, though my oldest SCCS
recorded reference to $RANDOM in my dot files dates back to 1993).

I.e. no, not just about every other shell has $RANDOM -- all those that
are derivatives of Ash, as well as any AT&T /bin/sh or derivative, still
don't have $RANDOM (and many of those without $RANDOM have few other
features that can reliably class them as non-ksh-like).

Of course I'm not at all opposed to adding $RANDOM to any shell, or
indeed to POSIX.

I just wanted to point out that this remains reliable to this day so
that I can drop my dot files on any system and expect them to work no
matter what login shell I've been given.

Again for what it's worth I think though that a NetBSD /bin/sh with
$RANDOM will probably pass muster as a ksh clone for the few things that
matter in my dot files -- I just want to avoid having to invent a new
category for it just to keep it separate from both Ksh (and clones) and
other Ash derivatives that don't grow a $RANDOM.

-- 
						Greg A. Woods
						Planix, Inc.

<woods%planix.com@localhost>       +1 250 762-7675        http://www.planix.com/

Attachment: pgpyGYaJEdeCj.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index