Register
It is currently Fri Oct 24, 2014 4:20 am

Problem with date -d function in bash script. Please help!


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sat Jan 19, 2008 4:57 pm   

Joined: Sat Jan 19, 2008 4:47 pm
Posts: 2
Hi,

I have creating this incredible backup script, but my OS (OSX Leopard) seems to be having a peoblem with the following lines:

Code:
lday=`date +'image-%Y-%m-%d-%H' -d '1 day ago'`
lweek=`date +'image-%Y-%m-%d-%H' -d '1 week ago'`


When the scrpt executes I get the following error:

Code:
date: illegal time format
usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
date: illegal time format
usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]


I've narrowed it down to my usage of the -d '1 day ago' operators. Could anybody tell me what could be wrong with this....or if there's another way to get yesterday's date and last week's date?

Thank you very much in advance.


Top
 Profile  
 PostPosted: Sun Jan 20, 2008 3:15 pm   

Joined: Sun Jan 20, 2008 12:46 pm
Posts: 3
http://bashscripts.org/viewtopic.php?t=459


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP