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:

CHECK := 0
i := 0

.PHONY: syslog
syslog:
        $Q printf "\nLet's install syslog..."
# If the string !myapp exists, CHECK=0 > 1
        $Q $(eval CHECK := $(shell if grep -q \!myapp "/etc/rsyslog.conf" ; then
echo $$(( $(CHECK) +1 )) ; else echo $(CHECK) ; fi ) )
# Here, I want to do: if CHECK = 0 (!myapp does not exit), to do a while
like this:
        $Q while CHECK=0 && i -le 8 ; do \
              if grep -q local$i.* "/etc/rsyslog.conf" ; then echo $$(( $i +1 
)) ;
else echo $$(( $(CHECK) + 1 )) && printf
"\n\!myapp\nlocal$i.*\t\t\t\t\t/var/log/myapp.log" >> /etc/rsyslog.conf ; fi
\
              done
        $Q printf "\ndone!\n\n"

I don't know if it's clear:
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 ?

Thank you!



--
View this message in context: 
http://gnu-make.2324884.n4.nabble.com/Update-value-of-variable-tp17777p17782.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.

_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to