Test function not working

i am writing the following snippet and cannot figure out why the variable measType remains 0. it should be 1

I also tried "\#analog" and '\#analog' in the test statement and it still doesn't work. What is going on?

bash$ measType=0
bash$ read line < 2iconfig.ini
bash$ echo $line
#analog
bash$ if [ "$line" = "#analog" ]; then
> measType=1
>fi
bash$ echo $measType
0
bash$

Can you post the output of below command:

echo "$line" | od -c
bash$ echo "$line" | od -c
0000000 # a n a l o g \n
0000011
bash$

---------- Post updated at 10:57 AM ---------- Previous update was at 10:45 AM ----------

i found my problem! My text file had a \n at the end. that was being compared...since this is a non-printable asci character, i did not see the problem when i was printing it out. Thanks for teh suggestion of using the od command....just curious what do 0000000 and 0000011 mean?

0000000 & 0000011 represents bytes.

Refer this page for usages and examples.

0000000 is byte position 0, beginning of file.
0000011 is byte position octal 011 (decimal nine).

Also:

$ read line < 2iconfig.ini
$ [ "$line" = "#analog" ]
$ echo $?

You will get 0 or 1 depending on whether the test worked.