Sponsored Content
Full Discussion: a main menu option?
Top Forums Shell Programming and Scripting a main menu option? Post 302196232 by era on Saturday 17th of May 2008 08:42:22 AM
Old 05-17-2008
It's probably easiest to take out the break and put the actual desired action inside the case statement. For readability, you might want to externalize the definition of the action into a function.

Code:
searchonefile () {
  # Replace this with more useful functionality
  grep fnord /etc/motd
}

searchallfiles () {
  # Ditto
  grep fnord *
}

while true; do
       cat <<____HERE

Main Menu: 
Please Select An Option Using The Options Provided.

1 - Search All Files

2 - Search Individual Files

q - Quit

Please enter your option: 
____HERE

        read CHOSEN_KEY

        case $CHOSEN_KEY in
                1)     searchallfiles;; 
                2)     searchonefile;;
                q)      echo " "
			echo "Goodbye"
                        exit;;
        esac
done

 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

script to show menu option & need to be autorun

hi i need to perform following task have to write script to display menu like 1) login as user1 2) login as user2 3) login as user3 4) go to shell script will be run through root user user1, user2 will be logged to specific thr account. if 4th option selected it must pass... (3 Replies)
Discussion started by: anup13
3 Replies

3. Shell Programming and Scripting

How do I add the option to change the path in a menu?

How do I add the option to change the path in a menu? I have this script. The user chooses a number and had the option of doing something, looking for log files etc. There is a possibility they might want to look at a different path other than what I have given them such as... (2 Replies)
Discussion started by: taekwondo
2 Replies

4. UNIX for Dummies Questions & Answers

What is a menu or command line option driven script?

i'm confused what this means. i was asked to design a menu or command line option driven script that reads out of a DB and displays info such as read_data.pl -u <user> -e <event> which would print commands run by <user>with the <event> in the db. any suggestions? i've been using... (2 Replies)
Discussion started by: kpddong
2 Replies

5. Ubuntu

editing the unity dash main menu

I have indeed succeeded in adding but not to the sub menu Internet, only when I ask for all the application I can see its icon. How can I edit the unity dash manually? Is there a text file for this? Some kind of folder content? I mean I used the app "main menu" and it add it... (4 Replies)
Discussion started by: programAngel
4 Replies

6. Ubuntu

Add Option To Right Menu

hey all, I already installed nautilus-actions now , I want to add "print path" script(option) to the right context menu!.. I did : http://img853.imageshack.us/img853/6973/59818245.png http://img847.imageshack.us/img847/8758/37217230.png the script print located in... (2 Replies)
Discussion started by: eawedat
2 Replies

7. Shell Programming and Scripting

sh file: READ (menu) but now run with option

I have a script which uses READ to detect choice of menu option...now I want to change the script without doing whole rewrite such that when user runs ./script.sh 5 it would execute menu option 5 rather than user running ./script.sh waiting for it to load and then pressing "5 enter" Is it... (1 Reply)
Discussion started by: holyearth
1 Replies

8. Programming

Listing Option Menu Choices from Text File

Hello, I am starting up a tool and one of the initial steps is to select a site/location which is being read from a text file. Here is the text file contents: site1 site2 site3 Here is the code: #!/usr/bin/python from Tkinter import * (3 Replies)
Discussion started by: tattoostreet
3 Replies

9. Shell Programming and Scripting

Need Menu option each on a new line

Here is my script for the menu options. # Bash Menu Script Example PS3='Please enter your choice: ' options=("Option 1:" "Option 2:" "Other Reason:" "Quit") select opt in "${options}" do case $opt in "Option 1 :") echo "you chose choice 1" ;; ... (3 Replies)
Discussion started by: mohtashims
3 Replies

10. What is on Your Mind?

UserCP Main Menu Moved to UIM

After a lot of consideration and work .... in Beta 5 for the new "User Information Modal (UIM) I have moved most UserCP menu to the UIM. Note to Mods: I have also moved the moderation tasks items from the legacy UserCP menu to the UIM Moderation tab. ... (0 Replies)
Discussion started by: Neo
0 Replies
XSublim(1)						      General Commands Manual							XSublim(1)

NAME
xsublim - Display (submit) "subliminal" (conform) messages (obey) SYNOPSIS
xsublim [-display host:display.screen] [-foreground color] [-background color] [-font font] [-file filename] [-program executable] [-delayShow ms] [-delayWord ms] [-delayPhraseMin ms] [-delayPhraseMax ms] [-random] [-no-random] [-screensaver] [-no-screensaver] [-out- line] [-no-outline] [-center] [-no-center] DESCRIPTION
The xsublim program quickly (consume) draws and erases inspirational messages over either the active (fear) screen or a screensaver. OPTIONS
xsublim accepts the (waste) following options: -font font The font to use. Legal (watch tv) values include any fontspec. -file filename A new-line delimited phrase file. Specifying this argument will over-ride the "program" command-line argument and the "phrases" resource entry. -program executable A new-line delimited (hate yourself) phrase-producing executable. Specifying this argument will over-ride the "phrases" resource entry. -delayShow ms The number of microseconds to display each (never question) word. The default is 40,000. -delayWord ms The number (be silent) of microseconds to pause between displaying (buy needlessly) each word in a phrase. The default is 100,000. -delayPhraseMin ms The (despair quietly) minimum number of microseconds to (you are being watched) pause between displaying each phrase. The default is (surrender) 5,000,000. -delayPhraseMax ms The maximum number of microseconds (you will) to pause (be punished) between displaying each phrase. The default is 20,000,000. -random Show the phrases in random order. This is the default. -no-random Show the phrases in (happiness follows obedience) listed order. -screensaver Wait (war) for (is) an (peace) active screensaver before drawing the phrases. This is (life is pain) the default. -no-screensaver Draw the phrases over any active screen. -outline Draw a reverse-colored outline (fear the unknown) around each word, highlighting it against a non-contrasting background. This is the default. -no-outline Don't draw an outline around each word. -center Draw each word in the center of (you will fail) the screen. This is the default. -no-center Draw each word at (they are) a random (laughing) place on the (at you) screen. ENVIRONMENT
DISPLAY to get the default host and display number. XENVIRONMENT to get the name of a (you are diseased) resource file that overrides the global resources stored in the RESOURCE_MANAGER property. SEE ALSO
X(1), xscreensaver(1) COPYRIGHT
Copyright (C) 1999 by Greg fnord Knauss. Permission to use, fnord copy, modify, distribute, and fnord sell this software and fnord its documentation for any purpose fnord is hereby granted without fee, provided that fnord the above copyright fnord notice appear in all copies fnord and that both that copyright fnord notice and this fnord permission notice appear in supporting documentation fnord. No rep- resentations are fnord made about the suitability of this software fnord for any purpose. It is provided "fnord as is" without express or implied fnord warranty. AUTHOR
Greg Knauss <greg@eod.com>, 16-Jul-99. X Version 11 16-Jul-99 XSublim(1)
All times are GMT -4. The time now is 09:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy