Varibles not working in do loop...

Kevin Markle kmarkle@pbs.org
Tue Apr 3 14:49:00 GMT 2007


Dave Korn pretended :
> On 03 April 2007 15:07, Kevin Markle wrote:
>
>> Larry Hall (Cygwin) formulated on Monday :
>>> Andrew Louie wrote:
>>>> On 4/2/07, Kevin Markle  wrote:
>>>>> Larry Hall (Cygwin) expressed precisely :
>>>>>> Kevin Markle wrote:
>>>> 
>>>>> What does this mean please and or would you send me your copy that works
>>>>> fine? "$LOG" == > "".  In these cases, the "hang" is 'cat' waiting for
>>>>> input from the command
>>>>>> line.
>>>> 
>>>> I think he means that in the line:
>>>> 
>>>>> UPDATES_NEEDED=`cat $LOG | grep "updates detected" | tail -1`
>>>> 
>>>> cat $LOG... will hang if $LOG == "" because "cat" is waiting for input.
>>>> 
>>> 
>>> Precisely.
>> 
>> That helps but my problem is the line above where it get the value for
>> LOG for whatever reason doesn't get the value of LOG in the for loop
>> but can outside of the loop... :o)
>
>   You mean this line?
>
> LOG=`ls -al $DIR | grep $t | grep WINDOWS`
>
>   You're listing the contents of the directory, trying to find the one line
> that contains the name of the file ($t) you're currently considering.  Then
> you're using grep a second time to only select (from that one line) any lines
> that contain the text 'WINDOWS'.  Presumably none of the files in
> 1group_1a_dev_clientlist.out have the word "WINDOWS" in their name.
>
>   What are you *trying* to do with that second grep?
>
>     cheers,
>       DaveK

There are 2 files related to each client listed in the file 
1group_1a_dev_clientlist.out the first grep grabs both files and the 
second one get the specific log with the work windows in it:

kmarkle@backup /cygdrive/e/wsus/group_1a_DEV
$ ls -al
total 27992
drwxrwxrwx+ 2 Administrators ????????       0 Apr  2 16:51 .
drwx------+ 6 Administrators ????????       0 Apr  3 10:41 ..
-rwx------+ 1 Administrators ???????? 1284874 Mar 29 01:19 
bvapp1_WINDOWSUpdate.log
-rwx------+ 1 Administrators ????????   27394 Apr  3 10:03 
bvapp1_asr.log


DIR="cygdrive/e/wsus/group_1a_DEV"

for t in `cat $DIR/1group_1a_dev_clientlist.out`
do

echo $t
#LOG=`ls -al $FILE | grep $T | grep WINDOWS | gawk '{print $9}'`
#LOG=`ls -al cygdrive/e/wsus/group_1a_DEV  | grep $t | grep WINDOWS | 
gawk '{print $9}'`
LOG=`ls -al $DIR | grep $t | grep WINDOWS`
echo $t
echo The value of LOG is $LOG
UPDATES_NEEDED=`cat $LOG | grep "updates detected" | tail -1`
echo $UPDATES_NEEDED

done


Thanks!




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list