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