I think 

date -d "+ 1 day" +%d

is more appropriate,

thank you very much for the tip.

 


On Tue, 2004-02-03 at 13:44, Michael Chaney wrote:
> On Tue, Feb 03, 2004 at 12:01:45PM +0800, lito lampitoc wrote:
> > > roll your own!
> > 
> > I certainly could, just checking out if there is one available already.
> > maybe I'm just too lazy..
> 
> Look, this is a line of code.  It's not going to show up on freshmeat.
> 
> 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
> 
> You should get a book on shell programming and learn.  It's not tough.
> 
> 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