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 01:13 PM, mikeyzman wrote:
> Anyway, I'm not getting any echo back of the random number call, but the
> good news is M4 seems to be expanding without errors, I'm probably just
> missing an argument or something.
> 
> define(`number',`esyscmd(`/bin/bash -c "printf \"$RANDOM\""')')dnl

It worked for me:

$ m4
define(`number',`esyscmd(`/bin/bash -c "printf \"$RANDOM\""')')dnl
number
24246
number
4597
number
17644

> 
> The above is ultimately what Im trying to do, but when I include this and
> then type 'number', I don't see any output.   BTW this is command line mode
> for M4.   What I'm doing is invoking M4 command line style and then
> "include(`myinclude')" where myinclude has the above definition.  I should
> then be able to type number and get a number kicked back.   But what else am
> I missing? 

One other thing to try is m4's debugmode; 'm4 -daeqt' can prove rather
invaluable for tracing every single macro call.

-- 
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/

iQEcBAEBCAAGBQJMbDa0AAoJEKeha0olJ0NqIooIAIxMh4zcZJ7eQGlKOA/UWybR
ZuQQ2t/70eHMDo+aQhQJtBNZVRpdv+D0gncGKuM8LGllH7PSG0kUT98xJ7oTGS3E
59W0MqX/y+k71gKDzQCBmEZc0b5MyrjvdiCaORxQ3jrAU2kW6pcUOufaKAsjg72N
/W1sAT6K51XRAz1Fa0rQfkRqhJX9gs5uPYf6vMquXPlmNp1rQdeYuwh7Zddysqak
hXA7oVWPjYw1cyouvrjky25TdEjXTZnZpfHJAdhO0ujxRmarogDBV9c+c8hlmoP3
zgPQ0o3Ddg1PIF9tknCvy0DTLI/NII6tgl7hIysNRED47uSSQ8o8G6ClRcu71dE=
=kL8e
-----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.