westwood01
Technical User
Below is an example of a case script I'm using. The script works as expected, except for the q (quit/exit) option; it won't exit. Actually the script does exit properly if I choose q before choosing any other option. Unlike if I choose 2, then try and q, it wont work. I believe it has something to do with the select statement I'm using, but I'm not entirely sure. Any ideas? Thanks.
#!/bin/ksh
TODAY=`date +%m/%d/%y`
TIME=`date +%H:%M:%S`
while true
do
echo "
1) View ALL Failed Save Sets
2) Create Tickets for SERVER1 Failed Save Sets
q) Quit"
echo ""
read input
case $input in
1) clear
echo ""
echo "Listing of All Failed Save Sets:"
echo ""
awk '{print $0}' data.dat;./script.ksh;;
2) clear
grep server1 data.dat > tmp.server1
echo "Select Failed Save Set to Create Remedy Ticket"
echo "Listing of Failed Save Sets:"
echo ""
IFS="
"
select line in $(<tmp2.server1);do
echo ""
echo "You Selected $REPLY for:
$line"
echo "Continue y/n?"
read reply1
if [ "$reply1" = "y" ]
then
echo "Working . . ."
echo "$TODAY $TIME : $line" >> submitted.log
./maketicket;./script.ksh
else
echo "Request Cancelled";sleep 1
./script.ksh
fi
done;;
q) echo "Exiting . . . ";sleep 1;exit;;
*) echo "Please Make Another Selection";sleep 1;clear;./script.ksh;;
esac
done
#!/bin/ksh
TODAY=`date +%m/%d/%y`
TIME=`date +%H:%M:%S`
while true
do
echo "
1) View ALL Failed Save Sets
2) Create Tickets for SERVER1 Failed Save Sets
q) Quit"
echo ""
read input
case $input in
1) clear
echo ""
echo "Listing of All Failed Save Sets:"
echo ""
awk '{print $0}' data.dat;./script.ksh;;
2) clear
grep server1 data.dat > tmp.server1
echo "Select Failed Save Set to Create Remedy Ticket"
echo "Listing of Failed Save Sets:"
echo ""
IFS="
"
select line in $(<tmp2.server1);do
echo ""
echo "You Selected $REPLY for:
$line"
echo "Continue y/n?"
read reply1
if [ "$reply1" = "y" ]
then
echo "Working . . ."
echo "$TODAY $TIME : $line" >> submitted.log
./maketicket;./script.ksh
else
echo "Request Cancelled";sleep 1
./script.ksh
fi
done;;
q) echo "Exiting . . . ";sleep 1;exit;;
*) echo "Please Make Another Selection";sleep 1;clear;./script.ksh;;
esac
done