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 > UNIX for Dummies Questions & Answers
.
google unix.com



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
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
compare today's date with date in a file siog UNIX for Dummies Questions & Answers 4 10-04-2006 11:55 AM
Log File date compare for user defined range mojo24 Shell Programming and Scripting 0 05-05-2006 06:39 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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
  #2 (permalink)  
Old 10-04-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
This post looks quite similiar to the other one that you have posted - compare today's date with date in a file
I would almost consider this a duplicate thread. I will keep it open for now and see how it proceeds.

anbu23 has posted a reply to the other thread. See if that helps.
  #3 (permalink)  
Old 10-04-2006
Glenn Arndt's Avatar
Glenn Arndt Glenn Arndt is offline Forum Advisor  
Anomalous Lurker
  
 

Join Date: Feb 2006
Location: Indianapolis, IN
Posts: 255
Quote:
Originally Posted by siog
Code:
else
do nothing /*not sure how to say do thing.  should it be sleep? */

fi
You don't need an "else" statement if you don't want anything done. That is, just do
Code:
if [ $foo = $bar ]; then
  blorp
fi
If you really want to preserve your "else" but still do nothing, you can do
Code:
if [ $foo = $bar ]; then
  blorp
else
  :
fi
In your case, "sleep" wouldn't make sense since you don't have a loop; all it would do is sleep for a certain time and then quit. Usually you would sleep in a loop to wait before looping again.
Sponsored Links
Closed Thread

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 05:14 PM.


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