delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/04/02/15:39:03

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Kevin Markle <kmarkle AT pbs DOT org>
Subject: Varibles not working in do loop...
Date: Mon, 02 Apr 2007 15:38:11 -0400
Lines: 30
Message-ID: <mn.13aa7d74a3db2d48.51129@pbs.org>
Reply-To: kmarkle AT pbs DOT org
Mime-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hello,
I'm running this script and line 19 works when I create the variablea 
and type the command at a shell prompt. But when I try to run it from 
within the for loop it does not return a value and hangs?

Thanks!

Kevin M

$ more test_forloop.sh
#FILE=`cat 
"/cygdrive/e/wsus/group_1a_DEV/1group_1a_dev_clientlist.out"`
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




--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019