Re: random number generator

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.general
Organization Red Hat
Message-ID <[email protected]>
On 08/18/2010 11:58 AM, Eric Blake wrote:
>> printf: 1: usage: printf format [arg ...]
> 
> And dash's /bin/sh does NOT have $RANDOM, so you ended up doing the same
> as esyscmd(`printf ').

[I hit send too soon; here's some clarifications]

dash does not own /bin/sh.  What I meant was:

esyscmd uses /bin/sh (unless you specified differently at ./configure
time); dash does not have $RANDOM; therefore, if dash is installed as
/bin/sh, then esyscmd invokes a shell that does not have $RANDOM, and an
undefined unquoted variable is elided, so you ended up doing the same as
esyscmd(`printf ').

> But if you are intending to stick with `' quoting, then use:
> 
> esyscmd(`/bin/bash -c "\"$RANDOM\""')

esyscmd(`/bin/bash -c "printf \"$RANDOM\""')

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 619 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJMbCC3AAoJEKeha0olJ0NqUPQH/RopQq8m0qcmkZVu+Z29qD9i
ZRvKBYUtO3xgUHmU1Ga/1DdJzTlDxqxt1tAsT+fz//xN3gYtthn/He9qymllzcD0
rFgRIoO6xd5ZsBcZ4QoLB6vG0UOpiGm0dJbe78jSLXjU5/F/boaR60Cju3AGtFMC
Agte6EXUrSxOvLW9C31UAcvzJmVZ8jQDGFlUU5DjF0SzA5G0c+NO1NwoMPZdJ+Um
VTOXCYvzGSpPcO36hWVwtaepDHN2qqDLD3NEV0xOee6fXG3sdL2Cgk1csXq1T8zS
XLj8Bu9j1oEBsYj9NMLpxBVzPGLccscsDdOzbQzFwS7wTcEDcwL18ZFuiZFoCgc=
=Y4aJ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.