float comparison

I had a variable 1:80 8 in one varialbe say var=1:80 8

i comapred the below

if [ $var = "1:80 8" ]
then
--
else
----

thought if condition is true its always going in the else condition....its not giving any compilation errror also....is there any problem bcoz of space...

can some one help me out

Try this:

if [ "$var" = "1:80 8" ]
then
--
else
----

Also, as a good practice, use " " around variable names that are used for comparison.

mkan, you had a similiar post please help immediate which was locked because one of ours mods thought it to be a homework question. I shall not go against that judgement and provide the solution.

But read the man pages of sh. It will give you a better understanding. Look under the sections of QUOTING

Edit. Looks like the solution is already provided.

I dont think that this question falls under the "homework" category. The OP is not asking for a readymade solution for some problem - we get many more questions where the OP just asks "How do I..." without saying that they have actually done about it. This question refers to a single line in code that the OP has already written - I think that the doubt is legitimate, especially if you are new to scripting.