Dear Michael,

Despite your frustration, your email cry for help is music to my ears...

At the VM Workshop I shall be giving a presentation on something I call "Visual Bash". Visual Bash is a framework to help make bash programs easier to manage.

Consequently, my interest is not merely academic, I am really interested in bash code under zLinux.

As I understand it, you wish to query several zLinux instances in order to ascertain what is going on with each. If this is indeed what you are up to, and I may have gotten this wrong, then the place I would start is the method of connection from the query system to the target. Are you using ssh or something else?

While more information about the code would be welcome, I will continue to study your email in an attempt to understand the issue. I might immediately suggest blasting the bash code you have out onto git just so we could all really sink our shell teeth into it. The wisdom is that many eyes looking over your code will doubtless lead to a solution. If I can be of any immediate help, please do not hesitate to contact me.

Note that my frustration is that the Marist list is most picky. Hopefully this note will post.

Kindest Regards,

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

On Thu, 4 May 2017, Michael MacIsaac wrote:

Date: Thu, 4 May 2017 07:32:00 -0400
From: Michael MacIsaac <mike99...@gmail.com>
Reply-To: Linux on 390 Port <LINUX-390@VM.MARIST.EDU>
To: LINUX-390@VM.MARIST.EDU
Subject: Bash loop failing

Hello list,

This code has been failing for days and I'm at my wit's end.  Maybe someone
on this forum can help.

I've coded a bash script that is supposed to loop through managed Linux
systems. It calls another bash script to get records with 8 fields:

 local cmd="/usr/local/sbin/zlsexpirations -s -l $nodeList"
 local expList                            # list of nodes and expiration
days
 expList=`$cmd`                           # run the command

 ...

So the variable 'expList' has the records. It should then loop through all
the records passing them to the function zSetOneSystem to process one
system at a time. Here's the main loop (the double quotes around expList
are needed to pass a record, not just one token):

 local nextLine
 while read nextLine; do
   zVerbose "calling zSetOneSystem $nextLine"
   zSetOneSystem $nextLine
 done < <(echo "$expList")

This was my first attempt at the loop:

 echo "$expList" |
 while read nextLine; do
   zVerbose "calling zSetOneSystem $nextLine"
   zSetOneSystem $nextLine
 done

Both flavors of the loop above have this behavior:
1) If the -n flag (no operation) is passed, the loop runs fine to
completion.
2) If that flag is not passed, the loop runs, processes one system (which
results in files being changed on disk), but then the loop simply stops.

When I trace it, the 'read nextLine' fails.  I print out 'expList' after
the loop and all records are still in place. How can a sub-process affect
the parent this way? I've narrowed it down to two resulting bash script
calls nested deeper in zSetOneSystem(). If I comment out those two, the
loop succeeds.  If I un-comment either of the two bash scripts, the loop
fails as described.  Strange.

Any help will be appreciated.

Thanks.


--
    -Mike MacIsaac

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu 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 lists...@vm.marist.edu 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