thanks very much for being so helpful.

On Thu, 2004-02-05 at 10:25, Michael Chaney wrote:
> On Mon, Feb 02, 2004 at 11:44:37PM -0600, Michael Chaney wrote:
> > If you're using Linux, and the GNU date app, you can do this:
> > 
> > % date -d tomorrow +%d
> > 
> > That gives you the "day of the month" part of the date, for tomorrow.
> > If it's "01", then today must be the last day of the month.  Now, just
> > compare the output of the command to "01".  How you do this depends on
> > what shell you use, hopefully it's a Bourne shell (/bin/sh, bash,
> > probably ksh, too):
> > 
> > if [ $(date -d tomorrow +%d) = "01" ]; then echo "It's the last day!"; fi
> > 
> > In a shell script, it'll probably look more like this:
> > 
> > if [ $(date -d tomorrow +%d) = "01" ]; then
> >     echo "It's the last day!"
> >     # do some other stuff here
> > fi
> 
> One more point in this saga.  If you want to run something on the last
> Tuesday of the month, for instance, you can use code like this:
> 
> 
> if [ $(date +%w) = "2" ]; then
>       echo It's Tuesday
> 
>       if [ $(date -d "+ 1 week" +%m) != $(date +%m)  ]; then
>               echo This is the last occurance of this particular weekday this month
>       fi
> 
> fi
> 
> And, finally, the date command that comes with FreeBSD uses similar
> syntax, but instead of the "-d" use "-v" such as this:
> 
> date -v+1w
> 
> That will add one week to the current date before printing.
> 
> Michael

--
Philippine Linux Users' Group (PLUG) Mailing List
[EMAIL PROTECTED] (#PLUG @ irc.free.net.ph)
Official Website: http://plug.linux.org.ph
Searchable Archives: http://marc.free.net.ph
.
To leave, go to http://lists.q-linux.com/mailman/listinfo/plug
.
Are you a Linux newbie? To join the newbie list, go to
http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie

Reply via email to