I have following in a bash script:
echo "status: [$status] and message: [$message]"
if [ "${status}" -eq 0 && "$message" = "ERROR" ];
then
echo "Exit 0";
exit 0
fi
# status: message: [ERROR]
However, it gives below error, and the logic under
then
i.e. exit 0
never gets executed:
line 2: [: missing `]'
It seems to be complaining about the missing closing ]
, however, it is there. What am i missing here?
Asked by Nullpointer
(199 rep)
Jan 9, 2024, 03:54 PM
Last activity: Jan 9, 2024, 04:09 PM
Last activity: Jan 9, 2024, 04:09 PM