I have the below Unix code:
#!/bin/bash
var="LogLevel"
LogLevel="WARN"
check="\$$var = \\"WARN\\""
if eval $check ; then
echo "LogLevel contains WARN"
else
echo "Contains something else"
fi
My objective is how do i do double variable comparison inside my if loop.
Is this the right way to do it ?
I am getting the below error:
./check.sh: line 8: WARN: command not found Contains something else
Kindly guide me with this issue .