Unknown error - ``' unmatched

Hi Guys,

I get the error while running below commands. Earlier the command used to execute, but after enclosing them in a function, the error is occuring

backupPath=`echo $folderName | sed -e 's,/vobs/dte/itgClient/client/RegressionTestLibPostOHS/,,'`
check_event=`cat /sbt/driver/RegressionTests/ResultsArchive/$environment1/$backupPath/TestEvents.txt | grep "Test Cases FAIL"
| cut -c 18-`

Maybe put a set -x outside and inside the function to see what value is assigned to the variables at runtime.

try tu use $(...) in state of `...`

hi
can you write your function code ?

Thanks for your reply,

I replaced ('...') with $( ) , it worked.

Could you please mind explaining the reason for this.
Thanks

The problem with the backquotes is that they can't be embedded ie:

A=$(echo "$(ls)"); echo "$A" # is OK
A=`echo "`ls`"`; echo "$A" # returns error
1 Like

They can be nested actually, but the inner backticks will need to be escaped...

A=`echo "\`ls\`"`; echo "$A"

which can make it difficult to understand. I much prefer the $() construct..

1 Like

Another reason, $( ) can be easily identified, but ` ` will be always misunderstood as ' .