The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash for loop boot: cannot open kernel/sparcv9/unix command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix export command in unix find grep find mtime find null character in a unix file grep multiple lines grep or grep recursive inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime ping port remove first character from string in k shell replace space by comma , perl script rsync ftp scp recursive segmentation fault(coredump) sftp script snoop unix solaris change ip address stale nfs file handle syn_sent tar exclude tar extract to folder test: argument expected unix unix .profile unix forum unix forums unix internals unix interview questions unix mtime unix simulator unix.com vi substitute while loop within while loop shell script

View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 07-20-2006
Glenn Arndt's Avatar
Glenn Arndt Glenn Arndt is offline
Anomalous Lurker
 

Join Date: Feb 2006
Location: Indianapolis, IN
Posts: 255
You're checking to see if 20 files named using the form, "BARE01_DLY_MKT_yyyymmdd" (where "MKT" is variable between all 20 files). How would passing one file name to the script help? Unless you mean to pass the date to the script so that it checks for that date? That is, today's date is 20060720, but you want to check for 20 files with the date 20060719...?

check20.sh 20060803:
Code:
#!/bin/ksh
mydate=$1
integer filecount=0
for file in BARE01_DLY_???_$mydate; do
  filecount=$filecount+1
done

if (( $filecount == 20 )); then
  exit 0
else
  exit 1
fi
Note that there is no error checking here. You can feed anything you want as the date.
Reply With Quote