I have recently been doing some fairly involved shell programming on
QNX 6.1. My background is several years of work on HP-UX.
I am seeing a behavior in shell scripts that I never saw, so I wonder if
it’s somehow specific to QNX.
If I set a variable value within a loop, the variable is inevitably null upon breaking from the loop. This is true even if I “declare -x” the variable
at the head of script. It’s as if a block scope is being observed, and
variables set within the loop act as if they were declared there and
are not valid outside the loop block. I have tried bash and ksh both - same behavior.
Am I crazy? Has anyone else seen this? It’s completely contrary to all
shell documentation.
Thanks,
Randy C.