I have started working on the script below, but I cannot remember how to direct the script to go from one point back to another point. I.E. If the user does not respond to a question and just presses enter or enters a query that is not found, I would like the question to be re-asked until a valid response is entered.
#!/usr/bin/ksh
cd ~jxg4
echo " "
echo "Enter the description that you would like to search for: "
read desc
if [ "$desc" ]
then
awk -f TNG-desc.awk workloadjobs.out | sed 's/Description: //g' | grep $desc > workloadsdesc.rpt
else
echo "Enter the description that you would like to search for: "
read desc
fi
if [ $? -ne 0 ]
then
echo "\nNo match was found. Please try again.\n"
echo "Enter the description that you would like to search for: "
read desc
else
cat desc.header
cat workloadsdesc.rpt
fi
#######################
Any help would be greatly appreciated.
Thanks,
John
#!/usr/bin/ksh
cd ~jxg4
echo " "
echo "Enter the description that you would like to search for: "
read desc
if [ "$desc" ]
then
awk -f TNG-desc.awk workloadjobs.out | sed 's/Description: //g' | grep $desc > workloadsdesc.rpt
else
echo "Enter the description that you would like to search for: "
read desc
fi
if [ $? -ne 0 ]
then
echo "\nNo match was found. Please try again.\n"
echo "Enter the description that you would like to search for: "
read desc
else
cat desc.header
cat workloadsdesc.rpt
fi
#######################
Any help would be greatly appreciated.
Thanks,
John