12-14-2001
Menu function stuck in a loop?
I having problem when I call this cleanupmenu function within a script. It continuously loops and goes to selection * That wasn't a valid selection. I have to kill it everytime to stop it. What am I doing wrong. I use this function menu in several other scripts and I don't have this problem at all. Also, when I don't use this menu as a function and put it at the end of this script it does the same thing.
#!/bin/ksh
#
realname=` who -m | awk '{print $1}'`
#
# Create Cleanup Choice Menu Function
#------------------------------------------------------------------
cleanupmenu ()
{
echo " $realname Choose your Options"
echo " "
echo "1. Review Queue script before execution "
echo "2. Execute Script on $QMGR"
echo " "
echo "x Exit Menu "
echo "--->\c" | tee -a $LOG
read
case $REPLY in
1 ) page $QL_LOG3 ;;
2 ) runmqsc $QMGR < $QL_LOG3 | tee -a $LOG ; echo " Exiting ..Goodbye $realname!" ;;
x|X ) echo " Exiting ..Goodbye $realname!" ; break;;
* ) echo "$realname That wasn\'t a valid Menu Selection! Try Again." ; sleep 1 ;;
esac
}
echo "Hello $realname" | tee $LOG
echo "$realname - What Queue Manager would you like to use?: \c" | tee -a $LOG
read QMGR
echo "You chose $QMGR" | tee -a $LOG
echo "extracting amq3 file names"
sleep 1
print "dis ql(AMQ.3*);" | runmqsc $QMGR >$QL_LOG1
awk /QUEUE/ $QL_LOG1 | cut -f2 -d\( | cut -f1 -d\) | sort >$QL_LOG2
exec < $QL_LOG2
while read line ; do
echo 'delete qlocal('${line}')' >>$QL_LOG3
done
cleanupmenu
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Below is my menu options code. It allows user to pick one of two option. I can get the first option to work, because if it is selected it just "breaks" and carries on with the script.
What i want to know is if a user selects option two how do i get that option to ignore all the other script and... (6 Replies)
Discussion started by: amatuer_lee_3
6 Replies
2. Shell Programming and Scripting
Below is my menu options code. It allows user to pick one of two option. I can get the first option to work, because if it is selected it just "breaks" and carries on with the script.
What i want to know is if a user selects option two how do i get that option to ignore all the other script and... (3 Replies)
Discussion started by: amatuer_lee_3
3 Replies
3. Shell Programming and Scripting
Hi all! Im trying to get this script to check for folders in a year/month/day folder structure and if the day doesnt exist then it makes the day. It will also make sure all of the days before todays date exist as well. This script assumes that the month and year folder already exist. It works... (3 Replies)
Discussion started by: Grizzly
3 Replies
4. Shell Programming and Scripting
I am using a Perl script to open a series of files in a loop, separate the paragraph into lines, and output the lines into a new file. The code works perfectly fine, except when the source file is over a certain size the loop gets stuck and won’t move on to the next file. It still does what it is... (0 Replies)
Discussion started by: renthead720
0 Replies
5. Shell Programming and Scripting
I'm a noob working on a script to take 3 user inputs. One of them is simply a variable: "poolname". The other 2 are cases: "groupa/groupb" and "enable/disable". "groupa" and "groupb" reference 2 files - groupa.txt or groupb.txt. These files simply consist of a list of server IP addresses and port... (2 Replies)
Discussion started by: *nixnoob
2 Replies
6. Shell Programming and Scripting
Hi,
I have a script that copies a file from one directory to another and compiles it.
What I have now is a menu that calls functions and each function compiles the file.
I want to have a function that compiles the file at the end of the script if the user selects options 1-3 in the menu, but... (0 Replies)
Discussion started by: amitlib
0 Replies
7. Shell Programming and Scripting
In the bash menu below if the variant that is inputted is in the format NM_004004.3:c.274G>T the below works perfectly. My question is if the variant inputted isNM_004004.3:-c.274G>T or NM_004004.3:+c.274G>T then the code as is will throw an error due to a biological issue. Is it possible to to... (1 Reply)
Discussion started by: cmccabe
1 Replies
8. Shell Programming and Scripting
Hi All,
I have a menu driven scripts. As you know while running the script we have to input the option such as 1,2, and 3 to execute function accordingly. but after selecting the input we have to press Enter.
My requirement is to execute function as soon as we press the option.
Is there... (5 Replies)
Discussion started by: kiran_j
5 Replies
9. Shell Programming and Scripting
hi i am new to bash scripting ..
i created a bunch of folders but only want the folder names with file1. so i go in and make an array to grab the folders the put in a file then i strip the directories so i just have the folder names i need then i would like to make the menu with a selection... (3 Replies)
Discussion started by: lamby22
3 Replies