The UNIX and Linux Forums  
Hello and Welcome from United States 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




Thread: date
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 03-17-2009
curleb curleb is offline
Registered User
  
 

Join Date: Mar 2008
Location: Here, in my Ivory Tower...
Posts: 68
It might vary by the system's version of date, but something like the following might work:

Code:
export my_date=$(date +'%w') 

if [[ $my_date = '0' ]] || [[ $my_date = '6' ]] 
then
...
fi
or

Code:
export my_date=$(date +'%u') 

if [[ $my_date = '6' ]] || [[ $my_date = '7' ]] 
then
...
fi
Note, that the above varies by ksh93's version of date. But you'd really only want this to run once a day, no? What is there to block the job if it's already running/been run that day...?