| k.balamurugan@gmail.com 2005-11-13, 5:53 pm |
| I have following script
#!/bin/sh
#set -x
#
cat $newParamListFile | grep "^$1" |
while read line
do
paramQ=`echo $line | cut -f4 -d':'`
echo $paramQ
read ans
echo $ans
done < ./newparams.list
the newparams.list contains following data
fiel 1:param1:param value1:Question1
file 1:param2:param value2:Question2
fiel 2:param1:param value1:Question1
fiel 2:param2:param value2:Question2
When the script invoked as follows
../scriptfile file1
I want to display the Questions corresponding to file1 one by one and
get the answer from the user. The second read is causing the problem it
doesnt wait for user input. It reads Question2 and displays.
Is there any other way I can acchive what I want.
Note: I wanted to use only /bin/sh only for backward compatibility
reasons.
--Thanks,
Balamurugan.
|