Hi,
welcome to LQ.
your sample code doesn't make sense to me but I guess you are looking for something like:
Code:
foo=$(date)
echo "The date is $foo"
The above uses the date command to produce some output that is stored in the variable $foo.
HTH,
Evo2.