Here's what I'm trying to do... I want to connect to a command line application and send it instructions from inside a script. I need to do a loop as there are multiple things I want to do. I was able to accomplish this by connecting and disconnecting inside the loop, but I'd rather connect once, do my loop and then disconnect once. Is that possible? Here is my current script. (Note I'm connecting to a queue manager and executing something for each queue defined in a text file).
#!/usr/bin/ksh
if [ $# -lt 2 ]
then
echo "USAGE: $0 qm queue_file"
exit 1
fi
qm=$1
file=$2
if [ ! -r $file ]
then
echo "${file} does not exist...."
exit 1
fi
cat ${file} | while read queueName
do
runmqsc ${qm}<<!
display ql(${queueName}) CURDEPTH
end
!
done
(So basically, the 'runmqsc' should only be executed once and the 'end' should only be executed once...)