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
"find command" to find the files in the current directories but not in the "subdir" swamymns Shell Programming and Scripting 9 07-22-2008 12:23 PM
acessing awk array element while getline < "file" timj123 Shell Programming and Scripting 9 06-28-2008 12:13 AM
grep to find content in between curly braces, "{" and "}," keshav_rk Shell Programming and Scripting 4 08-09-2007 11:14 PM
Keep getting error "No such file or directory" vanloonmichel Shell Programming and Scripting 16 02-14-2007 08:53 AM
Installaion error:"cannot find:/etc/......" bukky SUN Solaris 0 12-22-2006 03:31 AM

 
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 09-30-2008
mkbaral mkbaral is offline
Registered User
  
 

Join Date: Sep 2008
Location: New Delhi, India
Posts: 2
Error to "find" a matching array element in a directory

Hi,
I have defined an array which holds a couple of elements which are nothing but files names. I want to find the files in a directory for the matching file name(array elements) with less than 1 day old.
When I am trying to execute the code (as below), it gives an error.

Your help in this regard is solicited.

#!/bin/ksh
#########################################################################
# Mainline Section #************************************************************************
# Name: dailyjobcheck.ksh
#************************************************************************
RETCD="Return-Code= 0"
DATADIR=/usr1/MKB333/test
BPRDDIR=/app301/MKBTEST611/BPRD; export BPRDDIR
set -A bprdArr tibpsext tibjelvj tibjechk tibjevt2 wmsbxtvx tibapepr.log cisbworm
cntB=0
echo "Job ran on `date +"%m/%d/%Y"` " >>$DATADIR/test
echo "Statistics: \n" >>$DATADIR/test

while [ $cntB -le ${#bprdArr[@]} ]
do
FILE=`find $BPRDDIR -type f -mtime -1 -name "`echo ${bprdArr[cntB]}`*"`
if [ -f $FILE ];
then
RC=`awk '/Return-Code= 0/ { print $5,$6 }' | $FILE`
if [ "$RC" = "$RETCD" ]
then
echo "`echo ${bprdArr[cntB]}` ran OK on `date | cut -c1-3`day" >>$DATADIR/test
else
echo "`echo ${bprdArr[cntB]}` Abend \n" >>$DATADIR/test
fi
else
echo "`echo ${bprdArr[cntB]}` did not run on `date | cut -c1-3`day" >>$DATADIR/test
fi
cntB=`expr $cntB + 1`
done
----------------------------------------------------------
ERROR
----------------------------------------------------------
dailyjobcheck.ksh[41]: dailyjobcheck.ksh: cannot execute
find: The -name option requires filename argument.
dailyjobcheck.ksh[41]: tibpsext: not found
dailyjobcheck.ksh[42]: test: arg
ument expected
---------------
---------------

Regards,
Ketan
 

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 01:06 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