Michael,

Glad you got it fixed!

Regards,

Flint

On Thu, 4 May 2017, Michael MacIsaac wrote:

Date: Thu, 4 May 2017 11:12:30 -0400
From: Michael MacIsaac <[email protected]>
Reply-To: Linux on 390 Port <[email protected]>
To: [email protected]
Subject: Re: Bash loop failing

Thanks to all who replied - I tried most, but not all suggestions

The good news is I got the bug fixed.

It's pretty clear that 'stdin' was getting 'drained' somewhere down the
stack (I'm still now sure where), as John M. suggested.

Using another file descriptor instead of stdin (0) worked around the issue:

 *exec 3<&0  *                              # Link file descriptor #3 with
stdin.
 local nextLine
 while read -u 3 nextLine; do
   zVerbose "calling zSetOneSystem $nextLine"
   zSetOneSystem $nextLine
 done *3<* <(echo "$expList")               # read from expList on file
descriptor 3


On Thu, May 4, 2017 at 10:40 AM, Neale Ferguson <[email protected]>
wrote:

Rather than using read can you load the results of the command into an
array and iterate:


FILES=`ls`

FILE=(${FILES})

for ((i=0; i<${#FILE[@]}; i++))

do

   echo ${i} ${FILE[$i]}

   done

Exit


This should load the variables before the other scripts are invoked.


Neale

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or
visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/




--
    -Mike MacIsaac

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/


Kindest Regards,



☮ Paul Flint
(802) 479-2360 Home
(802) 595-9365 Cell

/************************************
Based upon email reliability concerns,
please send an acknowledgement in response to this note.

Paul Flint
17 Averill Street
Barre, VT
05641

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to