Sponsored Content
Full Discussion: Simple bash script menu
Top Forums UNIX for Dummies Questions & Answers Simple bash script menu Post 302755411 by mutley2202 on Sunday 13th of January 2013 04:43:47 AM
Old 01-13-2013
Hope this helps

Hi Fusetrips,
Try using the below its off one of the scripts I already have built.

Code:
*) echo "Please select a valid choice ";
echo "Press a key to return to the menu. . ." ; read ;;
esac
:
done


to the user running the script it looks like the below

Code:
Enter your menu choice:
30
Please select a valid choice
Press a key to return to the menu. . .

once a key has been pressed it returns to the menu

Last edited by Scrutinizer; 01-13-2013 at 05:47 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simple BASH script?

Hi guys, I'm new to the forum so forgive me if I'm sounding ... daft. I currently work in a Tech Support role. Every day we have to generate data by running around 10 .sh scripts. I was thinking instead of having to ./filename 10 times is it possible to right a new script that will run these for... (16 Replies)
Discussion started by: JayC89
16 Replies

2. Shell Programming and Scripting

simple bash script

I am writing a shell script in bash one of the thing I want to show is size of export /home du -sk /export/home/oracle | cut -c 1-5 echo "kbytes" when I run the script kbytes shows up in the second line, How can I append kbytes on the same line, such as 61233 kbytes please guide thanks (2 Replies)
Discussion started by: Tirmazi
2 Replies

3. Shell Programming and Scripting

Bash menu script

I have a main menu quit=n while do clear echo echo "1. General system information" echo "2. Hardware utilisation information" echo "3. File management" echo "4. User information" echo "5. Information on network connectivity" echo "6. Information on processes" echo "Q.Quit" ... (3 Replies)
Discussion started by: AngelFlesh
3 Replies

4. Shell Programming and Scripting

Execute interactive bash menu script in browser with PHP

I have an interactive menu script written in bash and I would like use PHP to open the interactive bash menu in a browser. Is this possible? Using the sytem() function in php runs the script but it's all garbled. Seems like maybe a terminal window needs to be opened in php first? ... (1 Reply)
Discussion started by: nck
1 Replies

5. Shell Programming and Scripting

need a simple bash script

to gather the cpu utilization from a system in 5 minute intervals and direct output to file. I'm new at scripting and while this seems like an easy task I'm confused on where to start. thanks for any help (1 Reply)
Discussion started by: mkeyes001
1 Replies

6. Shell Programming and Scripting

Help regarding a bash menu script

Greetings all, I'm having some trouble writing a menu drive bash script, actually coding the menu part was not difficult however its a problem with a menu option I'm having trouble with. My menu has 5 options, when the user selects the second option, they are then prompted to enter a number from... (5 Replies)
Discussion started by: Vitrophyre
5 Replies

7. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies

8. Shell Programming and Scripting

Bash Script - Whiptail Menu Help!

Hello, Been trying to build a menu with whiptail lately. However, my code doesn't seems to be working even though when i compared to other similar code they looks the same. #!/bin/bash clear whiptail --msgbox "Entering networking sub-menu" 20 78 whiptail --title Networking --menu... (8 Replies)
Discussion started by: malfolozy
8 Replies

9. Shell Programming and Scripting

Menu Driven Bash Shell Script with Default Option

Hi All, I have written a menu driven bash shell script. Current Output is as below: ------------------------------------- Main Menu ------------------------------------- Option 1 Option 2 Option 3 Option 4 Exit ===================================== Enter your... (3 Replies)
Discussion started by: kiran_j
3 Replies

10. Shell Programming and Scripting

Creating bash script to process a data file based on the menu

Hey, im fairly new to unix and Im trying to make this unix project that would display a menu and do the following. MENU =========================== (p, P) Print users info (a, A) Add new user (s, S) Search user (d, D) Delete user (x,X) Exit Enter your choice: Trying to... (3 Replies)
Discussion started by: ultimaxtrd
3 Replies
MAILPLATE(1)															      MAILPLATE(1)

NAME
mailplate - reformat mail drafts according to templates SYNOPSIS
mailplate [[--new | -n] | [--editor | -e]] [--keep-unknown | -k] [--verbose | -v] [--debug | -d] template-name message-file mailplate [--keep-unknown | -k] [--verbose | -v] [--debug | -d] template-name < message-data mailplate [[--auto | -a] | [--menu | -m]] [[--new | -n] | [--editor | -e]] [--keep-unknown | -k] [--verbose | -v] [--debug | -d] message-file mailplate [[--auto | -a] | [--menu | -m]] [--keep-unknown | -k] [--verbose | -v] [--debug | -d] < message data mailplate [--help | -h] mailplate [--version | -V] DESCRIPTION
mailplate is a programme that reformats mail drafts according to a given template. The template may be specified on the command line, but mailplate can also use control information from the template files to automatically select an appropriate template (--auto). A selection menu feature is planned (--menu). Applying a template means obtainined select data from an existing mail message (unless --new is specified) and to fill it into appropriate slots in the template. Messages are processed in three parts: headers, body, and signature. When --new is given, an empty instantiation of the template is written to stdout. At the moment, --new cannot be combined with --editor. The template can define two types of headers: mandatory and preservatory. Mandatory headers take precedence over headers in the existing message and thus overwrite them. Preservatory headers instruct mailplate to port their data from the existing mail message. Headers in the existing message but not defined in the template are dropped, unless --keep-unknown is given. Body and signature are separated by '-- '. If this sentinel is not found, no signature is extracted. Templates can be interpolated and data filled into slots. Helper slots are filled with the output of helper commands (which must be defined in the configuration), environment variable slots are just that, and mail variable slots can be filled with data obtained by running regexps or commands over the message. This script can be run in multiple ways: o As a filter, it applies a template to data from stdin and writes the result to stdout. o When --editor is passed, the script spawns sensible-editor on the result. It may thus be used as the editor for your mail user agent. o Given a file, it modifies the file, unless it cannot write to the file, in which case it writes to stdout. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`--'): --auto, -a Turn on template auto-discovery. --menu, -m Choose from a list of templates (not yet implemented) --new, -n Create a new message. --editor, -e Spawn editor once template is applied. --keep-unknown, -k Preserve mail headers not specified in template. --verbose, -v Write informational messages to stderr. --debug, -d Start a debugger after initialisation. --help, -h Show summary of options. --version, -V Show version of program. MUTT INTEGRATION
I use mailplate as my $editor for mutt, with the following setting in my ~/.mutt/muttrc: set editor="~/.bin/mail/mailplate --edit --auto --keep-unknown" mailplate currently has a bit of a limitation, or at least I have not figured out a way how to work around it sensibly yet. If you re-edit a message from mutt's compose menu, it causes mailplate to reprocess the message, which you may not want. Similarly, if you find yourself editing messages from the index or pager, you probably also don't want mailplate to get in the way. For these cases, I currently use the following two keybindings: macro compose e ':set my_editor="$editor"<enter>:set editor=sensible-editor<enter><edit-headers>:set editor="$my_editor"<enter>' "invoke normal editor to edit message" macro index,pager e ':set my_editor="$editor"<enter>:set editor=sensible-editor<enter><edit>:set editor="$my_editor"<enter>' "invoke normal editor to edit message" VIM INTEGRATION
I am often editing a message with vim and find that I need to use a different identity. For this purpose, I have the following keybindings in my ~/.vim/ftplugin/mail.vim: nmap <buffer> <F1> :w<CR>:%!mailplate --keep-unknown --auto<CR> nmap <buffer> <C-P><F1> :w<CR>:%!mailplate --keep-unknown private<CR> nmap <buffer> <C-P><F2> :w<CR>:%!mailplate --keep-unknown debian<CR> Now when I reply to a message, mailplate automatically choses the right template, and if I later change my mind, I can press C-p, to override the choice and select the private template, or just hit to have it re-run the auto-detection. SEE ALSO
http://madduck.net/code/mailplate/ /usr/share/doc/mailplate/README AUTHOR
This manual page was written by martin f. krafft <madduck@madduck.net> with help from Carl Furstenberg. COPYRIGHT
Copyright (C) 2007 martin f. krafft September 30, 2007 MAILPLATE(1)
All times are GMT -4. The time now is 03:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy