Question about shell scripting in UNIX


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Question about shell scripting in UNIX
# 1  
Old 03-24-2014
Question about shell scripting in UNIX

Unix script coding help?
i am trying to write a code that will display following menu to user:
(A) Add
(B) Subtract
(C) Multiply
(D) Divide
(E) Modulus
(F) Exponentiation
(G) Exit
Then ask user for choice (A-F). After taking users choice ask user for two numbers and
perform chosen operation on those two numbers. The program should keep asking
for choice / numbers unless user chooses ‘G' for exit.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question regarding for shell scripting.

I tried to run a command which simply generates SSH key with out prompting password. After several trails , got the below command to run the script : ssh-keygen -t rsa -N "" -f id_rsa -N "" tells it to use an empty passphrase (the same as two of the enters in an interactive script) -f... (0 Replies)
Discussion started by: ulaxmi
0 Replies

2. Shell Programming and Scripting

Shell Scripting Question

Hi guys, I am wanting to create a script that will logon to HackThisSite.org and complete Programming Mission 11. You can find a link to this mission here for your reference: www hackthissite org/missions/prog/11/ The following is what I have so far: #!/bin/bash USER="myUsername"... (0 Replies)
Discussion started by: spooke
0 Replies

3. Shell Programming and Scripting

Question in shell scripting

Hello, I have a scenario for which I am trying to write a shell script and I have a question regarding the same. Here's the situation: I am trying to copy a directory which consists of a few sub-directories and .c and .dat extension files say n number of times so that the copied file have... (3 Replies)
Discussion started by: corntown118
3 Replies

4. UNIX for Dummies Questions & Answers

shell scripting question

Testing for the presence/absence of a pattern in a file, using /bin/sh: while read a; do b="${a##*pattern*}"; ; done < file This returns 0 if there's a match. That signal ($?) can then be used outside the loop. However this method reads through the whole file, even if the match... (2 Replies)
Discussion started by: uiop44
2 Replies

5. Shell Programming and Scripting

scp shell scripting question

HI all, I am attempting to use the scp statemet in a shell script that I am writing I need to have the user of the script enter a password at the time of the shell script running.I have the following questions? 1) how do i disable the automatic text echo when the user is entering the... (1 Reply)
Discussion started by: Segwar
1 Replies

6. UNIX for Dummies Questions & Answers

Shell Scripting Question

Hi, I am assaigning the output to the variable outp and when i try to loop thru the variable i see the original content $OUTPUT also in the array outp. I dont want to have the original content in the array outp. Please reply. outp=$(echo $OUTPUT | awk '{FS = "|"}{ for(i=0;i<NF;i++)... (8 Replies)
Discussion started by: vijaykrc
8 Replies

7. Shell Programming and Scripting

basic shell scripting question

If I did indeed grep something out of it, why woudln't $result show nothing? When I do $? , it does show success... What is the proper syntax so that $result shows actual thing it's grepping out? result=`(ssh $host tail -1 /something/somethingelse) | egrep -i "value" >dev/null` #echo... (3 Replies)
Discussion started by: convenientstore
3 Replies

8. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

9. Shell Programming and Scripting

Shell Scripting Question

To anyone who can help greetings, I am a beginner at Unix shell scripting. I need to know how to use the command line tool "itstat". I understand it's application, however I cannot find any additional information. Any assistance will be greatly appreciated. (3 Replies)
Discussion started by: tech2040
3 Replies

10. Shell Programming and Scripting

Shell Scripting Question

To anyone who can help greetings, I am a beginner at Unix shell scripting and am taking a class. The assignment question is as follows: use a command-line tool named "itstat" which will display the resolution of an image file and some other lines of information. It accepts a list of image... (1 Reply)
Discussion started by: tech2040
1 Replies
Login or Register to Ask a Question
RATMENU(1)						      General Commands Manual							RATMENU(1)

NAME
ratmenu - create a menu to run commands SYNOPSIS
ratmenu [ -display displayname ] [ -font fname ] [ -fg foreground-color ] [ -bg background-color ] [ -io item-offset ] [ -label name ] [ -shell prog ] [ -align {left|center|right} ] [ -style {snazzy|dreary} ] [ -persist ] [ -version ] [ menuitem command ] ... DESCRIPTION
ratmenu is a simple program that accepts a list of menu item and command pairs on the command line. It creates a window that consists of nothing but a menu. When a particular item is selected, the corresponding command is executed. ratmenu does not recognize any usage of the rodent. It is entirely keystroke operated. Menu items must be followed by a command. The syntax is based on that of the dialog program. ratmenu accepts the following command line options. -display displayname Use the X display displayname, instead of the default display. -font fname (X Resource: font) Use the font fname, instead of the default font. -label name Change both the window and icon labels of the window to name. The default label is the last component of the path used to run ratmenu, typically, ratmenu. -fg foreground-color (X Resource: fgcolor) Set the foreground color to foreground-color. By default, the foreground color is black. -bg background-color (X Resource: bgcolor) Set the background color to background-color. By default, the background color is white. -io item-offset Set the first selected item to item-offset. By default, the first item is the top-most one, or item-offset 1. The next item down would be at item-offset 2. -style {snazzy|dreary} (X Resource: style) The default style is snazzy, where the highlight bar, which shows the currently selected item, remains stationary while all the menu items are rotated up or down when the cursor keys are moved. In dreary mode, the highlight bar moves up and down the menu as it does on all conventional keyboard controlled menus. -align {left|center|right} (X Resource: align) Align the text of the menu entries to the left, right, or center. Defaults to left. This is different from 9menu, which defaults to center. -shell prog Use prog as the shell to run commands, instead of /bin/sh. A popular alternative shell is rc(1). If the shell cannot be executed, ratmenu will silently fall back to using /bin/sh. -back prevmenu prevmenu is a command or shell script to run when the back key is pressed, usually a script that has ratmenu showing the pre- vious menu. Used to create nested menus, it gives the user a way to back out and return to the previous menu. Note that you can use this option for other things too. The command specified by the -back option is executed when the user hits one of the "back" keys. -persist (X Resource: persist) Ordinarily, ratmenu exits if a new window pops up on top of it, or if you switch to another window. This option tells ratmenu to hang around, like a regular window. -version This option prints the version of ratmenu on the standard output, and then exits with an exit value of zero. KEYSTROKES
The Up keystrokes move the selection to the next item up. The Down keystrokes move the selection to the next item down. When the selec- tion reaches the top or bottom, it scrolls around to the other side on pressing of the appropriate keystroke. The Select keystrokes execute the command corresponding to the currently selected menu item, and exit ratmenu. The Exit keystrokes quit ratmenu without doing anything. Up 'k', Up_arrow, BackSpace, '-', C-p Down 'j', Down_arrow, Space, Tab, '+', C-n, C-i Select 'l', Right_arrow, Return, C-f, C-m, C-j Back 'h', Left_arrow, C-b Exit 'q', Escape, C-g CONFIGURATION USING X RESOURCES
You can configure some items using xrdb to load appropriate X resources. There is an example configuration in the file /usr/share/doc/rat- menu/Xresources.ratmenu which shows all possible configuration items. Give it a look; it is fairly easy to figure out. EXAMPLES
ratmenu -label "Remotes xterm" acme "rsh acme xterm" herman "rsh herman 9term" & ratmenu -label 'X progs' ghostview ghostview xdvi xdvi xeyes xeyes xneko xneko & ratmenu -back ~/bin/mypreviousmenu "X Eyes" xeyes & SEE ALSO
ratpoison(1), ratpoisonrc(5), dialog(1) xrdb(1) Ratpoison Desktop Users Manual. AUTHORS
The initial idea for this program was by Arnold Robbins, after having worked with John Mackin's GWM Blit emulation. Matty Farrow wrote a version using libXg, from which some ideas were borrowed. This code was written by David Hogan and Arnold Robbins. Rich Salz motivated the -shell option. Jonathan Walther modified this code to play nicely with the ratpoison window manager by removing handling of mouse events and iconification. Zrajm C Akfohg made many improvements in his ratmen fork, including X resource handling, some of which were folded back in. Ratpoison Desktop For X Oct 10 2001 RATMENU(1)