cancel
Showing results for 
Search instead for 
Did you mean: 

HPUX System Admin Menu interface

HPUX System Admin Menu interface

I has been created main screen interface. Kindly find attachment. At the same time I encountered several problems and need your advice:

The question is at the main menu, when I selected the option , supposedly go through submenu. But can't and no functionality. Please see the screen and script as below


1) main menu
====================

Tue May 19 01:31:36 MYT 2009

Please Select:

A. DAILY LOGS CHECKING
B. USER-ID MANAGEMENT
C. MASTER OFF USER-ID
D. PRINTER MANAGEMENT
E. BACKUP
f. HOUSEKEEPING
g. PERFORMANCE MONITORING
h. SYSTEM INFO
I. OTHERS
J. Exit



Select by pressing the letter and then ENTER


script:
==========
#!/bin/sh

amenu="A. DAILY LOGS CHECKING" ;
bmenu="B. USER-ID MANAGEMENT " ;
cmenu="C. MASTER OFF USER-ID " ;
dmenu="D. PRINTER MANAGEMENT " ;
emenu="E. BACKUP " ;
fmenu="f. HOUSEKEEPING " ;
gmenu="g. PERFORMANCE MONITORING " ;
hmenu="h. SYSTEM INFO ";
imenu="I. OTHERS ";

badchoice () { MSG="Invalid Selection ... Please Try Again" ; }

apick () { dailymenu.txt ; }
bpick () { usridmenu.txt ; }
cpick () { masteroffmenu.txt ; }
dpick () { printermenu.txt ; }
epick () { backupmenu.txt ; }
fpick () { housekeepingmenu.txt ; }
gpick () { performancemenu.txt ; }
hpick () { sysinfomenu.txt ; }
ipick () { othersmenu.txt ; }



themenu () {

clear
echo `date`
echo
echo
echo "Please Select:"
echo
echo $amenu
echo $bmenu
echo $cmenu
echo $dmenu
echo $emenu
echo $fmenu
echo $gmenu
echo $hmenu
echo $imenu
echo "J. Exit"
echo
echo $MSG
echo
echo Select by pressing the letter and then ENTER ; }

MSG=

while true
do

themenu


read answer


MSG=

case $answer in
a|A) apick;;
b|B) bpick;;
c|C) cpick;;
d|D) dpick;;
e|E) epick;;
f|F) fpick;;
g|G) gpick;;
h|H) hpick;;
i|I) ipick;;

j|J) break;;

*) badchoice;;

esac

done
4 REPLIES
Dennis Handly
Acclaimed Contributor

Re: HPUX System Admin Menu interface

>supposedly go through submenu. But can't and no functionality.

Your submenu code looks like this:
apick () { dailymenu.txt ; }

Is dailymenu.txt suppose to be a script? If so, it probably should end in .sh or .ksh, not .txt.
Suraj K Sankari
Honored Contributor

Re: HPUX System Admin Menu interface

Hi,

Remove the while loop and run it

Suraj
Viktor Balogh
Honored Contributor

Re: HPUX System Admin Menu interface

hi,

if those *.txt files contains the submenu code then set they to executable:

# chmod +x *menu.txt

after that, you can run the submenu code like this:

apick () { ./dailymenu.txt ; }

However if they are really containing script code, it is best practice to rename them to *.sh or *.ksh
****
Unix operates with beer.
tan chin tiau
Occasional Contributor

Re: HPUX System Admin Menu interface

thanks all for your opinion , the problem has been solved .