The UNIX and Linux Forums  
Hello and Welcome from to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 05-29-2007
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,423
If you can't modify the format of the date in DATESTAMP, create another variable with the right format :
Code:
DATESTAMP2=`date +"%m/%d/%Y"` # Sol 1
DATESTAMP2=$(echo $DATESTAMP | sed 's_^\(..\)\(..\)_\1/\2/_') # Sol 2

if grep -q $DATESTAMP2 HOLIDAYFILE
then
   echo "Holiday !!!"
fi
Jean-Pierre.