![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compare date from db2 table to yesterday's Unix system date | sasaliasim | Shell Programming and Scripting | 9 | 12-01-2008 11:37 PM |
| Perl: Extracting date from file name and comparing with current date | MKNENI | Shell Programming and Scripting | 4 | 03-26-2008 04:01 PM |
| date issue-find prevoius date in a patricular format | bsandeep_80 | UNIX for Advanced & Expert Users | 3 | 11-15-2007 08:42 PM |
| Changing Creation Date to a Prespecified Date of a File In Unix | monkfan | UNIX for Dummies Questions & Answers | 4 | 11-28-2006 07:15 AM |
| Specify a previous date as start date in shell script | ritzwan0 | Shell Programming and Scripting | 2 | 09-25-2006 05:58 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi, I have been trying just about every unix command to come up with yesterday's date (today's date - 1). I have seen all of the help on this forum, and none of it seems to work for me here. We are using Sun Solaris 9 Unix. I am using this script to create a .txt file with ftp commands that I will run from another script. All I want to do, is retrieve whatever files are at the ftp site with a date of yesterday in the filename. I have been trying to get the date right with Unix but obviously I am not having much luck.
I have tried a number of ways to get yesterday's date and none work for me. #CalcDate=`date +%Y%m%d` #CalcDate=`date -d yesterday +%Y%m%d` #date="1 day ago" +"%Y%d%m" I am able to output today's date to the .txt file using the following (see below). CalcDate=`date +%Y%m%d` cd /apps/PT8.44/outputs/backflow echo 'lcd /apps/PT8.44/outputs/backflow/test' > bflowin.txt echo 'mget *'$CalcDate* >> bflowin.txt echo 'quit' >> bflowin.txt Contents of bflowin.txt after script runs: I need it to be 20081119 (yesterday's date). lcd /apps/PT8.44/outputs/backflow/test mget *20081120* quit Any help you guys can give would be appreciated. |
|
||||
|
Thanks Ikon......the second code example worked perfectly for me. I am no longer frustrated! Have a great weekend :-)
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| unix commands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|