The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Create Year directory, date subdirectory and archive the file madhunk UNIX for Dummies Questions & Answers 2 12-13-2007 11:25 AM
Specify a previous date as start date in shell script ritzwan0 Shell Programming and Scripting 2 09-25-2006 06:58 PM
Directory create date Bab00shka UNIX for Dummies Questions & Answers 2 06-29-2005 11:42 AM
create directory named current date flowrats UNIX for Dummies Questions & Answers 2 07-31-2002 12:26 AM
How to find Previous date and Coming date arunava_maity UNIX for Dummies Questions & Answers 2 05-24-2001 12:41 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-18-2007
sridhusha sridhusha is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 16
want to create directory with the previous date

I need some help to complet the below script:

DATE1=`date "+%d"`

#DATE2=`expr $DATE1 - 1`

#DATE3=$DATE2`date "+%m%y"`

DATE4=`date "+%a"`

if [ $DATE4 = Mon ]; then

DATE2=`expr $DATE1 - 3`

else

DATE2=`expr $DATE1 - 1`

fi

cd /data/builds/612hf8/SAS/retail/plan_61/scripts/meserver

DATE3=$DATE2`date "+%m%y"`

mkdir $DATE3

echo "dir created"

mv *.log $DATE3

echo "logs moved to $DATE3 folder"



The above script creates the directory with the previous day date.


along with the above script output, i need how to create month end directories that means 30th or 31st of date. if suppose date is 1st of any month, this script not creating directory of the previous date that is 30th or 31st.

Please some body help me to complete above script.

I would appreciate your help.

Thanks,
Sridhar.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0