I'm becoming freaking crazy because of bash programming
I have the following:
result="ERROR|0" # From a complex sed execution
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?
Editing: Actually, now it works, so I add the previous code where I get the "result" string
result=$( [some code that gives me an output] \
| grep "Executed" \
| sed s/'\(.*\) Executed \(.*\) of \(.*\) \(.*\) (.*)'/'\4|\3'/ \
)
it should return a string, shouldn't it? The string I wrote before
bash? do you get errors? what doesecho ${array[@]}print?