Assigning an expression to a variable in shell script

i am trying to assign the following expression to a variable in Unix shell script
and want to use that variable in some other expression. But unable to get the required thing done. Please help with this....

This is the expression which i want to provide as input the variable

date '+%y:%m:%d' | awk -F":" '{printf"20%2d%2d%2d\n",$1,$2,($3-1)}' | sed 's/ /0/g'

like

d = `date '+%y:%m:%d' | awk -F":" '{printf"20%2d%2d%2d\n",$1,$2,($3-1)}' | sed 's/ /0/g'`
mget m.log.$d*

i tried like this but it is showing "d" not found

Please help me to get output like this

m.log.20140413

That is not a good way to get the previous day. What happens on the 1st of a month?
Variable assignments do not have spaces around the = sign. You need to leave them out.

OS : SunOS
Version : 5.10

---------- Post updated at 05:44 AM ---------- Previous update was at 05:41 AM ----------

Thanks Scrutinizer,,,

It worked when i removed the spaces before and after the "=" sign

---------- Post updated at 06:02 AM ---------- Previous update was at 05:44 AM ----------

Hi Scrutinizer
I understood your point about the date when it is the first day of next month,,,

can you please provide some script which can help me on this?

Thanks in advance

---------- Post updated at 06:08 AM ---------- Previous update was at 06:02 AM ----------

Hi Scrutinizer

I found something like this in the internet which gives yesterday's date automatically

d=`gdate -d'yesterday' +%Y%m%d`

I tried and it worked

Do u have any idea about this,, will it solve this problem when it is the first day of the month?

Please reply if u know anything about it

Check this link
http://www.unix.com/answers-to-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html