[Top][All Lists]

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

Re: Strange behaviour with variable

From: Paul D. Smith
Subject: Re: Strange behaviour with variable
Date: Wed, 7 Jan 2004 07:36:31 -0500

%% address@hidden writes:

  hpvl> Sorry I left this out, Yes I had a filter function for comment lines in
  hpvl> with # and empty lines: 
  hpvl> GREP = egrep -v '^ *$|#' 

This is not correct, because you're not quoting the "$".  Make will
expand the "$" and the next single character ("|") here as a variable
named "|", but that variable is obviously empty.

So, when you use this variable it really expands to:

  egrep -v '^ *#'

which is not the same thing and probably explains why you're not
matching the right things.  You need to use "$$" to escape the "$".

  hpvl> first I had the line: 
  hpvl> MODULES   = $(shell cat ../bin/module.hier | egrep -v '^$|#' ) 
  hpvl> But then make complained about missing ). 
  hpvl> I thought that # in a shell function was allowed but it seems
  hpvl> that make is interpreting everything after # as comment even if
  hpvl> it is in a shell function??

This might be a bug; I'll have to look into it.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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