LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 02-04-2003, 04:40 PM   #1
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Rep: Reputation: 30
Question Figuring out yesterday's date within a script


Hello there,
I'm writing a script right now and in order for it to work properly I need to figure out what yesterdays date was. Currently I'm using:

DATE=`expr $(DATE +%d) - 1`

This is fine and dandy until its the first of the month. The DATE variable will be 0 and I would like it to be the date it was before, such as 31, not 0. Get what I'm trying to say? Is there any work around for this rather than me hard coding this into my script? I looked at the switches for "date" and I didn't see anything.

Thanks,
Chris Koniecny
 
Old 02-04-2003, 04:47 PM   #2
chrisk5527
Member
 
Registered: Oct 2002
Location: Michigan
Distribution: Slackware Linux 10.0
Posts: 289

Original Poster
Rep: Reputation: 30
NEVERMIND! I FOUND IT! Its "date --date=yesterday".. My bad....
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to append today's date in a script anjaan Programming 4 06-12-2004 08:37 AM
Script add date to filename amphion Linux - Newbie 2 06-02-2004 07:12 AM
help with Date command in script icw_sec Programming 6 01-06-2004 11:02 AM
Date in a BASH script... soulsniper Linux - Software 7 11-22-2003 06:08 PM
can't retrieve the date in my script wedgeworth Linux - Software 0 09-15-2003 11:41 AM


All times are GMT -5. The time now is 11:21 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration