sed q predicate doubt

Hi,

Could anyone please explain me what the following command does?

sed -ne "/\"$var\"/{=;q}" file

It is trying to print the line number where the value of $var is present in the file.

sed -ne "/$var/{=;q}" file
[root@bt]-> cat infile
a
b
c
d
e
f
g
h
[root@bt]-> var=c
[root@bt]-> sed -ne "/$var/{=;q}" infile
3

-n Do not print anything
/$var/{} Search for value in $var, if found execute whatever is there inside {}
= Print the line number
q Quit, basically quit when you find the first occurrence

HTH
--ahamed