help-make
[Top][All Lists]
Advanced

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

Re: Uupdate value of variable


From: Duane Griffin
Subject: Re: Uupdate value of variable
Date: Fri, 2 Jun 2017 10:35:14 +1200

Hi,

On Thu, Jun 1, 2017 at 7:24 PM, icvallejo
<address@hidden> wrote:
> Hello and thank you for your answers.
>
> I want to know if exists a string (!myapp) in rsyslog.conf file and if there
> is not exist, check if exists another string (local?.* where ? is a number
> between 0-7), and to do a printf in file so, for the first:

It doesn't sound like make is really the right tool for the job.
You're just going to end up with a single rule that always runs and
does all the work with an inline shell command. It would be better to
just write and call a shell script instead: make really does nothing
for you in this case.

> # If the string !myapp exists, CHECK=0 > 1
>         $Q $(eval CHECK := $(shell if grep -q \!myapp "/etc/rsyslog.conf" ; 
> then

You are still trying to assign a makefile variable from within a
recipe. You can't do that.

> First, if exists !myapp, if it does not exist, to do a while to check if
> exists local?.* where ? is a number between 0-7. At the moment that local?.*
> does not exist, take it, to do a printf and exit of while. Is it possible ?

To make this work CHECK and i need to be shell variables, not makefile
variables. As I said, you're going to end up doing all the work in a
shell command so just write a shell script. Or, better, look into
tools designed for this job such as augeas or ansible, etc.

Cheers,
Duane.

-- 
"I never could learn to drink that blood and call it wine" - Bob Dylan



reply via email to

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