Shell script date function

In a shell scipt i use test command to check for a file which has the date as part of its file name

File name example:- ABCDEFG_20100330.csv.gz

Shell script:-     if ( test ! -f /opt/ABCDEFG_`date +%Y%m%d`* )

This checks for a file which has the current date in its format.  
How do i do the same but check for the day before file. ( eg current date -1day)

I would also need to unzip and move this file to diffrerent directory

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you can do:
yesterday=`TZ=$TZ+24 date +%Y%m%d`
then use:
if ( test ! -f /opt/ABCDEFG_${yesterday}* )

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kamaraj SubramanianApplication Support AnalystCommented:
Hi Yuzh,

Can you please explain the below line, what is TZ and why you adding +24

yesterday=`TZ=$TZ+24 date +%Y%m%d`

you are calculation of yesterday is perfect
stopmAuthor Commented:
Hi Yuzh

Would the format be different if the script was #!/bin/bash  shell ?

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

TZ  is the Timezone variable for your login shell, +24 add 24 hours to your current timezone, then out put the date (it is the same as yesterday), if you -24 hour from your timezone, it will output tommrrow's time.
Hope it can make sense to you, cheers!
Sorry, didn't read your last comment.
the syntax works for sh/ksh/bash, so #!/bin/bash  should work.
stopmAuthor Commented:
Being in NZ time zone i had to change it to +12 for "yesterday" before midday
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.