On 08/18/2010 03:08 PM, mikeyzman wrote:
>> It worked for me:
>>
>> $ m4
>> define(`number',`esyscmd(`/bin/bash -c "printf \"$RANDOM\""')')dnl
>> number
>> 24246
>> number
>> 4597
>> number
>> 17644

Bah.  Problem of quoting.  "" interpolates within the outer shell, so
you _also_ need to escape the $ to have it make it to the inner shell.

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

That's why I like [] better than `' when mixing m4 with shell, because
'' quoting is easier than "" quoting for writing bash -c 'do-this'
one-liners.

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to