bash version or string issue

Hi all,

I'm not sure but I guess, that is a bash version issue.
The script working fine on "GNU bash, version 3.2.25(1)-release Ubuntu".

#!/bin/bash
while IFS=">" read a id val
do
if [[ "$id" =~ "</" ]]
then
VAL=${id%<}; ID=${id#</}
echo $VAL
echo $ID
sed "s|<${ID}>|${VAL}|" temp.txt >> temp
mv temp temp.txt
fi
done < file2.xml

but not running on "GNU bash (C) 2.05 SUSE".

Error message:

line 5: conditional binary operator expected
line 5: syntax error near `=~'
line 5: ` if [[ "$id" =~ "</" ]]

Any suggestions?

Try this:

[[ "$id" = "</" ]]

Yeah, =~ is a new operator. It matches like a regexp anywhere in
the string, use globbing instead, substitute it by:

[[ $a = *\<* ]]

HTH Chris

Sorry, but none of both result working :confused: !
No records in temp.txt!

If i do a little test like:

url="nothing here </really_nothing"
[[ "$url" = *\</* ]] && echo true || echo false

It results in true, so it matches. What do you get?

ones again Chris, THANK YOU :o