I am trying to install something in tomcat webapp. This is beginning of my install target:tomcat=`locate --regex ^(/var/lib/tomcat[0-9]{1,2}/webapps/[^/]+/)AppName\.html$ -l 1 | tr -d \n`echo Tomcat: $tomcat# If the string is empty (no path matched) or the path does not exists (that should never really happen)# terminateif [ -z $tomcat ] || [ ! -f $tomcat ]; then   echo Application not found on filesystem.  exit 404fiHowever this is the output:tomcat=`locate --regex ^(/var/lib/tomcat[0-9]{1,2}/webapps/[^/]+/)AppName\.html -l 1 | tr -d \n`/bin/sh: 1: Syntax error: Unterminated quoted stringmakefile:77: recipe for target 'install' failedmake: *** [install] Error 2Everyone else claims that you can use ` (backtick) to assign command stdout output into variable. I even used tr -d \n to delete all newline characters, may they appear. And the code works flawlessly in shell:XXXXX@debianvirtualbox:~$ tomcat=`locate --regex ^(/var/lib/tomcat[0-9]{1,2}/webapps/[^/]+/)AppName\.html$ -l 1 | tr -d \n`XXXXX@debianvirtualbox:~$ echo $tomcat/var/lib/tomcat8/webapps/websight/AppName.htmlWhat else is there to fix?
Put command result in variable within makefile target
bash;make
$ signs are notorious in makefiles for causing trouble because they are interpreted as variable markers. Here just doubling the one in the first line should do the trick:AppName\.html$$Also have a look at other posts to learn more about makefile escaping issues.