Re: Trouble with m4 on linux

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.bugs
Organization Red Hat, Inc.
Message-ID <[email protected]>
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
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.