date manipulation

HI,
I'm comparing my file date with the system date and if both the dates are equal I'm doing some operation. I use two variables for these two dates. I use the following command in my query. if [ $cd=$fdate]....
But here the current date $cd shows 01 and filedate $fdate shows 1. The file is created on 1 of the month. Because of this the condition is not matching and goes to else part of my pgm. Why it is showing filedate as 1 while listing? How to manipulate this? Kindly let me know.

Thanks in advance.

pstanand

How are you getting the date of the file i.e. filedate?

I'm using the following command to get the file date.
fdate=`ls -l filename|awk -F" " '{print $7}'
echo $fdate

Regards
pstanand

hi buddies,

can you please let me know the solution

touch -t YYYYMMDDhhmmss /tmp/touchfile
find ./  ! -older /tmp/touchfile  | \
while read file
do
  # do stuff with the file here
done

where YYYYMMDDhhmmss is, say, midnight (the start of today)

under ksh you can use typeset when defining your variables...it'll level the presentation and therefore evaluation of the values:

$ cd="01"
$ fdate="1"
$ echo $cd $fdate
01 1
$ typeset -i cd="01"
$ typeset -i fdate="1"
$ echo $cd $fdate

typeset does not provide for an export, however. You'd need to do this separately...

uh-duh...

chopped the display somewhat in the last post:

$ cd="01"
$ fdate="1"
$ echo $cd $fdate
01 1
$ typeset -i cd="01"
$ typeset -i fdate="1"
$ echo $cd $fdate
1 1