
July 9th, 2003, 04:31 PM
|
|
Junior Member
|
|
Join Date: Jul 2003
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
KSH: Reading Configuration File With While Loop Issue
I have a ksh script that reads a configuration file, then calls a function with the variable as an argument:
egrep '^[^# ]' $BATCHCONFIG | while read i; do
export VAR1=`echo $i | cut -f1 -d:`
export VAR2=`echo $i | cut -f2 -d:`
export VAR3=`echo $i | cut -f3 -d:`
do_something $VAR3
done
The problem is that the function that is called calls a binary that sometimes requires user input. The problem is that the user input is then read by the outer while loop and seen as input by the associated read command, thus prempting any chance for the user to provide said input.
I've isolated the issue to the 'while read i; do' loop as the problem does not occur when calling the function manually.
Any ideas how to get around this?
-A.
|