![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
| Display Modes | Rate This Thread |
|
|