bug-m4
[Top][All Lists]
Advanced

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

Re: Trouble with m4 on linux


From: Eric Blake
Subject: Re: Trouble with m4 on linux
Date: Wed, 29 Jul 2020 20:17:02 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 7/17/20 7:57 PM, M.R.P. zensky wrote:
Hello I am on linux. M4 is installed. I try to define a macro in M4 by typing 
M4 —define (test,Hello)  I just get the message “bash: syntax error near 
unexpected token `(`   Do I need to install or setup some other program than m4 
for it to work? What am I doing wrong?

Are you trying to define the macro 'test' to expand to the contents 'Hello' from the command line? If so, that would be done as:

$ m4 --define test=Hello

Or, if you are trying to define it while in m4:

$ m4
define(`test', `Hello')

On the command line, you have to abide by bash's syntax (such as proper shell quoting for anything that would otherwise confuse the shell, such as bare '(') and the fact that definitions on the command line are not spelled the same as macro expansions within m4 proper, but are rather name=value arguments (if you are familiar with 'make', that's another program that has similar command-line syntax).

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]