[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hpux-admin
Subject:    [HPADM] Dublicate check Scripting Problem
From:       GN <gniko () intrasoft ! gr>
Date:       2001-01-31 9:17:11
[Download RAW message or body]

integer i
ls files/ > ./files.lst
nof=`ls files/ |wc -l`
    while read xx
     do
      i=$i+1
       while read ff
        do
          if [ "$ff" != "" -a "$xx" = "$ff" ]
            then
                printf "%S\n" "Check Dublicate $ff"

            else
                untap files/$ff
                printf "%s\n" "$ff" >> ./files.idx
            fi
        done < ./files.lst
      if [ "$nof" = "$i" ]
    then 
    goto 10
    fi

done < ./files.idx
10:echo exiting....


In this script I would like to do the following:
1. reading a directory
2. check if the files in this directory exist in the index (files.idx)
    if exist messages a signal
    if not runs the untap
3. when the files reach a number exits the loop

What happens is the the loop is running continuesly and I cannot control the \
dublicate check in parallel with  the file counting. I would be very gratefull if \
could help me


[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-7">
<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>integer i</FONT></DIV>
<DIV><FONT size=2>ls files/ &gt; ./files.lst</FONT></DIV>
<DIV><FONT size=2>nof=`ls files/ |wc -l`</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; while read xx</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp; do</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i=$i+1</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while read 
ff</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT><FONT 
size=2>&nbsp;&nbsp;&nbsp; if [ "$ff" != "" -a "$xx" = "$ff" ]</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
then</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf 
"%S\n" "Check Dublicate $ff"</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
else</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; untap files/$ff</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp; printf "%s\n" "$ff" &gt;&gt; ./files.idx</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
fi</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; done &lt; 
./files.lst</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if [ "$nof" = "$i" 
]</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; then </FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; goto 10</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; fi</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>done &lt; ./files.idx</FONT></DIV>
<DIV><FONT size=2>10:echo exiting....</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>In this script I would like to do the following:</FONT></DIV>
<DIV><FONT size=2>1. reading a directory</FONT></DIV>
<DIV><FONT size=2>2. check if the files in this directory exist in the index 
(files.idx)</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; if exist messages a signal</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; if not runs the untap</FONT></DIV>
<DIV><FONT size=2>3. when the files reach a number exits the loop</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>What happens is the the loop is running continuesly and I 
cannot control the dublicate check in parallel with&nbsp; the file counting. I 
would be very gratefull if could help me</FONT></DIV></BODY></HTML>

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl

 Archives:  ftp.dutchworks.nl/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic