How to put output of one command into a variable

Hi,
Let say I have these 3 files (state, list and myscript). I want to be able get the sample output like below when I run myscript. Any one know how to fix the code? TIA.

 
```text
> cat /home/state
CA
 
> cat /home/list
CA 100 50 20
AUS 120 61 10
 
> cat myscript
#!/bin/sh
st='cat /home/state'
grep $st /home/list
 
> ./myscript    # this is the output I want.
CA 100 50 20
```

If your grep allows the -f flag, then you could do this

#!/bin/sh
grep -f /home/state /home/list

How do I get/compare the $st value, in "if-then" statement?

> cat myscript1
#!/bin/sh
st='cat /home/state'
if [ $st == "CA" ]
then
   do_this
else
   do_that
fi

Try this:

#!/bin/sh
st='cat /home/state'
if [ "$st" = "CA" ]
then
do_this
else
do_that
fi

I tried that before. it will run the "do_that" part, instead of "do_this".
If I add a line after "do_that" e.g. echo "$st", I got "cat /home/state" (without the double quote).

> ./myscript1
cat /home/state
�

Try this
st=`cat /home/state`
instead of
st='cat /home/state'

Great! it works.
Thanks to Jairaj and Vino.