![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Date Format | biju.mp | UNIX for Dummies Questions & Answers | 2 | 12-31-2007 05:56 AM |
| Date format | Knotty | UNIX for Dummies Questions & Answers | 2 | 04-11-2007 10:48 AM |
| Find julian date for given corresponding date | srikanthus2002 | Shell Programming and Scripting | 2 | 10-10-2006 06:33 PM |
| convert mmddyy date format to ccyyddd format?? | Bhups | Shell Programming and Scripting | 2 | 09-27-2006 08:30 PM |
| How to find Previous date and Coming date | arunava_maity | UNIX for Dummies Questions & Answers | 2 | 05-24-2001 08:41 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
date issue-find prevoius date in a patricular format
Hi ,
I have written a shell script that takes the current date on the server and stores it in a file. echo get /usr/home/data-`date '+%Y%d'`.xml> /usr/local/sandeep/GetFILE.ini I call this GetFILE.ini file from an sftp program to fetch a file from /usr/home/ as location. The file is in this format data-20071115.xml I have been succesfull in doing this. This runs froms tuesday to friday. But on Monday i need to fetch Saturday and Sunday file and i don't know how it can be accomplished in this. Can anyone help Thanks, Sandeep |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
Code:
#!/bin/bash if [[ $(date +%u) = 1 ]] then echo get /usr/home/data-$(date --date="-2 days" '+%Y%m%d').xml > /usr/local/sandeep/GetFILE.ini # some command that calls GetFILE.ini, before it is overwritten. echo get /usr/home/data-$(date --date="-1 days" '+%Y%m%d').xml > /usr/local/sandeep/GetFILE.ini else echo get /usr/home/data-$(date '+%Y%m%d').xml > /usr/local/sandeep/GetFILE.ini fi |