Thursday, 5 September 2013

Bash string comparison at if statement

Bash string comparison at if statement

I'm becoming freaking crazy coz bash programming
I have the following:
result="ERROR|0" # From a complex sed exectution
IFS='|' read -a array <<< "$result"
if [ "${array[0]}" == "ERROR" ]; then
echo "Error"
fi
It should print Error, but it doesn't
Any ideas what I'm doing wrong?

No comments:

Post a Comment