Re: retrieving and comparing the timestamp of the file with current date ..
From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 04/13/05
- Next message: Moe Trin: "Re: Question regarding Cron"
- Previous message: senthilS: "Re: retrieving and comparing the timestamp of the file with current date .."
- In reply to: senthilS: "Re: retrieving and comparing the timestamp of the file with current date .."
- Next in thread: senthilS: "Re: retrieving and comparing the timestamp of the file with current date .."
- Reply: senthilS: "Re: retrieving and comparing the timestamp of the file with current date .."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 13 Apr 2005 17:54:33 -0400
On Wed, 13 Apr 2005 at 21:25 GMT, senthilS wrote:
> Thanks Chris,
>
> Yep I tried this script and test coded, I did not get any error.
Then you didn't run the code you posted below. Which version of ksh
are you using? I don't have a copy of ksh88 available to test it,
so there a (very slim) chance it will work on that. It doesn't work
in pdksh or ksh93.
> 1)I wanted to know the why was case $7 used and also
> 2)set -- (I checked in man page for set and I could see the below
> information)
>
> sh
> set [ --aefhkntuvx [ argument ] ] ...
>
> I was using ksh so had a doubt in it.
>
> 3)Yes my code '$5 '$6' will not work properly ( but my earlier code did
> not give error, but if I would have enhanced this script this would
> have given me some problem, thanks for letting me know on this)
>
> 4) this should work I guess so.
>
> [1-9][1-9]) FILEDATE="$5 $6" ;;
NO! See below.
> I rectified few stuff :
> ====================================
> #!/bin/ksh
>
> set -`ls -l sample.txt`
This will still give an error.
> case "$5 $6" in
> [0-9][0-9]) FILEDATE="$5 $6" ;;
This is NOT what you want; it works now, because there are 2 digits
in the day of the month. In fact, this case statement does
absolutely nothing.
You need to pad a single digit day with an extra space.
> *) FILEDATE="$5 $6" ;;
> esac
> echo "$5 $6"
> echo $FILEDATE
>
> output :
>
> bash-2.03$ ./testtime.ksh
> Apr 3
> Apr 3
That is not the normal output of the date command you posted
previously. Perhaps yours is different, in which case you do not
need the case statement at all.
> =======================================
>
> Now I am going to take the output of $FILEDATE and compare it with
> current date.
>
>
> Thanks for all your help and time on this
>
--
Chris F.A. Johnson http://cfaj.freeshell.org/shell
===================================================================
My code (if any) in this post is copyright 2005, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
- Next message: Moe Trin: "Re: Question regarding Cron"
- Previous message: senthilS: "Re: retrieving and comparing the timestamp of the file with current date .."
- In reply to: senthilS: "Re: retrieving and comparing the timestamp of the file with current date .."
- Next in thread: senthilS: "Re: retrieving and comparing the timestamp of the file with current date .."
- Reply: senthilS: "Re: retrieving and comparing the timestamp of the file with current date .."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|