Sponsored Content
Full Discussion: Unix Menu program
Top Forums UNIX for Dummies Questions & Answers Unix Menu program Post 15664 by thekid on Monday 18th of February 2002 10:19:09 AM
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
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
Menu(3I)						    InterViews Reference Manual 						  Menu(3I)

NAME
Menu, MenuItem, MenuBar, PopupMenu, PulldownMenu, PullrightMenu - menus SYNOPSIS
#include <InterViews/menu.h> DESCRIPTION
N.B.: This Menu class is completely different from the Menu class in version 2.5. No attempt has been made to be compatible, as this class and its subclasses are more powerful and easier to use than the original class. Menu is a subclass of Control that contains a scene of other controls, called its body. When a menu is opened, it inserts the body into the world with a drop shadow. The appearance of the menu itself is defined by its interactor component. For example, a menu in a menu bar might appear as ``File'' and insert a pulldown menu with commands such as ``Save'' when opened. MenuItem is a subclass of Control for defining the leaves of a menu hierarchy. Normally, an application will derive a command class from MenuItem and implement the virtual function Do as appropriate. One technique is to pass the Command an application object and pointer to member function; the Do function calls the member function on the application object. PopupMenu, PulldownMenu, and PullrightMenu are subclasses of Menu that implement a common styles of menus. MenuBar is a subclass of HBox that manages the control state associated with a set of menus. PopupMenu has no appearance; it is opened explicitly in response to an input event. PulldownMenu and PullrightMenu open the menu body below and to the right of the menu, respectively. These classes make it possible to use menus in an application without creating or passing control states explicitly. PUBLIC OPERATIONS
Menu::Menu(Interactor*) Construct a new menu. Menu::~Menu() The destructor deletes the menu body in addition to its appearance component. virtual void Menu::Include(Control*) Add an item to the menu. If no scene is specified, Menu will create a vbox and insert items into it. virtual void Menu::Popup(Event&) Insert the body into the world centered around the coordinates associated with the event and activate the controls in the body. The menu is removed from the world when the controls are deactivated (normally when a button is released). void Menu::SetBody(Interactor*) Interactor* Menu::GetBody() void Menu::SetAlign(Alignment) Alignment Menu::GetAlign() void Menu::SetDepth(int) int GetDepth() void Menu::SetBodyState(ControlState*) ControlState* Menu::GetBodyState() void Menu::SetScene(Scene*) Scene* Menu::GetScene() Set or get attributes of the menu. The depth of a menu is the number of pixels separating the body and the drop shadow. Coord Menu::InsertX() Coord Menu::InsertY() Return the coordinates where the menu's body was last inserted into the world. MenuItem::MenuItem(Interactor*) MenuItem::MenuItem(const char* str, Alignment = Left) Construct a new menu item. The second constructor defines the appearance of the item to be a message containing the text in str. PulldownMenu::PulldownMenu(Interactor*) PulldownMenu::PulldownMenu(const char* str) PullrightMenu::PullrightMenu(Interactor*) PullrightMenu::PullrightMenu(const char* str) Construct a new pulldown or pullright menu. The second constructor defines the appearance of the menu to be a message containing the text in str. PopupMenu::PopupMenu() Construct a new popup menu. MenuBar::MenuBar() Construct a new menu bar. virtual void MenuBar::Include(Control*) Add a control to a menu bar. In addition to inserting the control into the bar's hbox, this operation attaches the control to the bar's control state. SEE ALSO
Control(3I), Event(3I) InterViews 6 December 1989 Menu(3I)
All times are GMT -4. The time now is 04:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy