The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-04-2006
siog siog is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 6
compare date with date in file

Hello everyone, I'm in desperate need of your help for this challenge I have below:
The run_dt_tbl has only 1 column and 1 row that contains a particular date in format mmddyy. I want to some how compare today's date with the date in this table that will be preset by someone else. If the dates match, run a bunch of procedures and unix commmands. If the dates do not match, do nothing. Below is the framework, please, please help lead me in the right direction to making this work. I am very new to unix scripting. Thank you so very much.


#!/bin/sh
today = date +%m%d%y /* setting today's date format to mmddyy */
run_date = 'the result of select * from run_dt_tbl'
if [$today -eq $run_date]
then
sqlplus -s <<EOF username/password @/dir_a/file1.prc > /dir_b/file1.log
@/dir_a/file2.prc > /dir_b/file2.log
exit
EOF

cp /dir_c/out1.txt /dir_d/out1.$(date +%m%d%y:%H%M%S)
else
do nothing /*not sure how to say do thing. should it be sleep? */

fi