Visit Our UNIX and Linux User Community


Unix Menu program


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Unix Menu program
# 1  
Old 02-15-2002
Unix Menu program

I am tasked with creating a front end 'menu' program where the users will type '1' to do this command or '2' to do that command. I have found some stuff that I can copy to do that but it looks too flimsy to roll out in a production envirionment. I was wondering if you guys might know of a more robust utility that already has that functionallity. All help and assistance is appreciated!!!


Thanks,
Todd
# 2  
Old 02-15-2002
I have a couple examples of code that is in production. Which shell will you use, and what OS are you running?
thekid
# 3  
Old 02-15-2002
# 4  
Old 02-15-2002
thanks guys.. all help is welcome. I am on AIX platform..
# 5  
Old 02-18-2002
Here is an example of a program which sends users into a Progress DB environment instead of allowing them to default into the unix shell upon login. This script is placed in a generic .profile file for users who do not need shell access. This script also only allows the user to log into the system once. This script runs on a Dynix/ptx 4.4.8 OS.
Code:
#!/bin/ksh
trap "" 2

if [ `/bin/who |/bin/grep "^$LOGNAME " |/bin/wc -l |/usr/bin/awk '
{print $1}'` -lt "2" ]
then
ulimit -c 2
while [ 1 ]
do
   tput clear
   echo ""
   echo "            ********************************************"
   echo "             Promotion Administrator Menu"
   echo "            ********************************************"
   echo ""
   echo "            1.  Prod Menu Screen"
   echo ""
   echo "            2.  Test Menu Screen"
   echo ""
   echo "            3.  Change Password"
   echo ""
   echo "            4.  System Messages"
   echo ""
   echo "            5.  Exit"
   echo ""
   echo "                Enter Choice : \c"
   read choice
   case $choice in
        1) /usr/bin/goprod;;
        2) /usr/bin/gotest ;;
        3) /usr/bin/passch ;;
        4) /usr/bin/sysmsg.sh ;;
        5)
      tput clear
      echo "              *******************************************"
      echo "                    Exit from System Completed."
      echo "              *******************************************"
      exit ;;
        *) echo "\n                     Invalid Option" ;;
   esac
done
else
        echo "Too Many Login Attempts."
        /usr/local/bin/excesslogins.sh
        echo "Pausing 10 seconds before closing window"
        sleep 10
        exit
fi

added code tags for readability --oombera

Last edited by oombera; 02-18-2004 at 04:31 PM..
thekid
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #879
Difficulty: Easy
Supervisory Control and Data Authorization (SCADA) is a control system architecture .
True or False?

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Gnome 3.28.3 menu item dissapears under the system menu

I installed CentOS 8 with Gnome 3.28.2 and I noticed that the "switch user" menu item disappeared from under the system menu of Gnome classic (Both X11 & Wayland). I checked google and this problem seems to have a history going back several releases of Gnome. Unfortunately, I never found a... (1 Reply)
Discussion started by: bodisha
1 Replies

2. Shell Programming and Scripting

Building a dynamic UNIX menu with input files

Hi! I am looking to build dynamic menu (named: lookup.sh) that reads a pipe delimited file for input. for example, contents of input.txt could be: user1|srv1 user3|srv1 user4|srv1 user2|srv2 I want the menu look like: 1) get password for user1 on srv1 2) get password for user3 on... (7 Replies)
Discussion started by: cpolikowsky
7 Replies

3. Shell Programming and Scripting

Need help in create menu with 3 sub menu using the case command

hi all i am a newbie to this is there any examples on creating a main menu with 3 sub menu main menu -> option a , b and c a menu -> option 1 ,2 and 3 b menu -> option 1 ,2 c menu -> option 1 ,2 i am getting headache as my code kept getting unexpected EOF ---------- Post... (0 Replies)
Discussion started by: chercm
0 Replies

4. Shell Programming and Scripting

Menu in Menu script issue

Problem: I am trying to create a menu in a menu script and I am running into an issue with the calculator portion of the script. I am first presented with the ==Options Menu== which all 5 options working correctly. Now comes the fun part. I select option 1 which takes me to my ==Calculator... (1 Reply)
Discussion started by: iDdraig
1 Replies

5. Shell Programming and Scripting

Menu list in Unix csh - command not found

Hello, im taking a class of Unix and i dont really know much about it, im trying to create a list of menu a user would select from and im very lost. Basically it will have 5 options, the user will chose from: 1. list files in the pwd 2. display date and time 3. is the file file or directory 4.... (5 Replies)
Discussion started by: morava
5 Replies

6. UNIX for Dummies Questions & Answers

proceed through a menu-based program with a script?

I am trying to figure out a way to proceed through a menu-based program in UNIX with just one command to execute several steps. Is this possible? From the command prompt I would normally type the name of the program, 'disk_analysis' to start the program and bring up its menu. I would then... (4 Replies)
Discussion started by: nichola$
4 Replies

7. Shell Programming and Scripting

Unix Shell Script: With Menu Option

I am attempting to create a shell script with the following capaciblities: 1. Listed options to choice from 2. Use to perform awk statements 3. Print a report with the awk results My questions are 1. How do I select more than one file for option #5 and #6 2. How to I create an... (11 Replies)
Discussion started by: jroberson
11 Replies

8. UNIX for Advanced & Expert Users

Menu Driven UNIX Admin

I need to have a script that can do an automated IPL function (how to reboot the box). I think ‘reboot’ would do the trick. However, how would I go about doing it, for example if the user states from a menu script that I would like to reboot now. The problem is when I do the ‘reboot’ command I... (6 Replies)
Discussion started by: ad4m88
6 Replies

9. Shell Programming and Scripting

How to pass variables to 3rd party unix menu?

Hello, I was wondering if it is possible to pass data to a unix driven 3rd party menu. Changing the code is out of the question. I have a menu with various options and I would like a ksh to execute the menu and input the required fields. For example. Main menu 1. Company Name 2. blah... (3 Replies)
Discussion started by: ctcuser
3 Replies

Featured Tech Videos