I am trying to store a condition for comparing values in a variable but it is not working. The code I have written is :
read op
if [ $op == "desc" ]
then
compare='${arr[0]} -gt ${arr[1]}'
if [ eval "$compare" ]
then
echo "SWAP"
fi
fi
what am I doing wrong?