How can a bash variable be written into a quoted variable ? For example;
x = '$RES'
when i echo this one, it returns $RES, but the code below ends with 1 (error)
test "$x" = "$RES" ; echo $?;
the command above should return 0 when it succeeds. What is wrong with that ?
thanks for a rapid reply,
Edit:
# this script is running with the rights of other user.(sudo)
# Usage: ./test.sh [password]
RES=$(cat .secret) # i have no read access right.
if [ ! -v "$1" ]; then
echo "Bad Luck! You are evil.."
exit 1
fi
if test "$1" = "$RES" ; then
echo "OK : $RES"
else
echo "Repeat it.."
fi
export x=RES
export RES=RES # i tried it in anyway like RES='$RES' and so on.
./test.sh $x
when i call a bash script with a parameter for example x and declare it by x=$RES it still does not bypass the equality.