01-17-2013
Thank you for the responce, however, i do not have a problem with looping the code. My big issue, is getting the code to work like an actual calculator.
Basically I would like the script to
1 - Prompt the user for a number.
2 - Prompt the user for the operation they would like to perform, either add, subtract, multiply or divide.
3 - Prompt the user for a number.
4 - Prompt the user for the operation they would like to perform, either add, subtract, multiply, divide
OR EQUALS.
5 - Display the result of the selected operation. The script should then exit or continue from step 3 if the user has not selected equals.
It is the (continue from step 3) bit that I just cannot get to work. Any ideas. Any help is very welcome, i have been racking my brains with this for too long now
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am very new to Unix and don't know much about it. I've been trying to create a menu and what I don't understand is how to execute a command once a user makes a selection. I have the menu set up. In fact, the following is the code that I have thus far:
#! /bin/csh
# This is the UNIX menu... (0 Replies)
Discussion started by: sinjin
0 Replies
2. Shell Programming and Scripting
Hi there. I'm trying to teach myself UNIX but the book I bought is a bit confusing. I'm trying out this exercise and I think I'm on the right track, but I'd appreciate any suggestions on how to improve what I have so far. Also, I'm not clear on how to use the read command to utilize the user's... (3 Replies)
Discussion started by: Jsmith
3 Replies
3. UNIX for Dummies Questions & Answers
hey all, me again....having a problem with my code, where I essentially am trying to show a menu, have the user select an option (from 1 to 5), then display which selection they picked...
#!/bin/bash
# A LIST OF THE ERROR MESSAGES AND THE PROPER SYNTAX:
error_0="Correct amount of... (1 Reply)
Discussion started by: SoVi3t
1 Replies
4. Shell Programming and Scripting
Hopefully I'm in the right place. Im new to the forums and linux!
I'm looking to add a menu to my perl hangman game i have created. The menu will use user input for the desired option and then perform the operation indicated. I would like something along the lines of:
Welcome to Hangman... (1 Reply)
Discussion started by: jahburmski
1 Replies
5. Shell Programming and Scripting
Hi, I am trying to make a maths calculator that:
1. Prompts the user for a number.
2. Prompts the user for an operation (add, subtract, divide or multiply)
3. Prompts the user for a number.
4. Prompts the user for another operation (same as above) OR the option to get the result for the... (4 Replies)
Discussion started by: johnthebaptist
4 Replies
6. Shell Programming and Scripting
EDIT : System used : Any Linux distribution.
Hello everyone,
I m having quite a headache trying to figure out why I m having a 2 columns output in the following code :
#!/bin/ksh
menu_rotation()
{
#Variables
CHOIX1="Rotation 1"
CHOIX2="Rotation 2"
CHOIX3="Rotation 3"
... (11 Replies)
Discussion started by: Sekullos
11 Replies
7. UNIX for Dummies Questions & Answers
Dear Sir,
May I know how do I go about adding the following feature into the script below:
When user enter values other than 1,2,3,4,
a) Message “Wrong entry !!! Pls select 1,2,3 or 4” is displayed
b) The screen is cleared again and the menu is displayed.
#!/bin/bash
clear
var=1... (2 Replies)
Discussion started by: fusetrips
2 Replies
8. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known/data:
Script a simple calculator. In the command line enter the script file
/home/etc/mycalc or /home/etc/mycalc 1 +... (6 Replies)
Discussion started by: herb bertz
6 Replies
9. Shell Programming and Scripting
A lot of my scripting makes use of the 'select' command to create menu driven input. A typical example of how I use it is as:
somevar=''
PS3='Select one: '
while ]; do
select somevar in $(sqlplus -s $dbuser/$dbpw@mydb <<EOF
set echo off feedback off verify off... (7 Replies)
Discussion started by: edstevens
7 Replies
10. Shell Programming and Scripting
ADE is a UNIX environment for the ancient AMIGA A1200. By default this does NOT have the 'bc' command line calculator.
Although I did a DEMO code to create a C source and compile it under python 1.4.0 and ADE using ksh88 and the gcc of the day, I decided to create this baby that requires no Python... (2 Replies)
Discussion started by: wisecracker
2 Replies
LEARN ABOUT CENTOS
git::svn::prompt
Git::SVN::Prompt(3) User Contributed Perl Documentation Git::SVN::Prompt(3)
NAME
Git::SVN::Prompt - authentication callbacks for git-svn
SYNOPSIS
use Git::SVN::Prompt qw(simple ssl_client_cert ssl_client_cert_pw
ssl_server_trust username);
use SVN::Client ();
my $cached_simple = SVN::Client::get_simple_provider();
my $git_simple = SVN::Client::get_simple_prompt_provider(&simple, 2);
my $cached_ssl = SVN::Client::get_ssl_server_trust_file_provider();
my $git_ssl = SVN::Client::get_ssl_server_trust_prompt_provider(
&ssl_server_trust);
my $cached_cert = SVN::Client::get_ssl_client_cert_file_provider();
my $git_cert = SVN::Client::get_ssl_client_cert_prompt_provider(
&ssl_client_cert, 2);
my $cached_cert_pw = SVN::Client::get_ssl_client_cert_pw_file_provider();
my $git_cert_pw = SVN::Client::get_ssl_client_cert_pw_prompt_provider(
&ssl_client_cert_pw, 2);
my $cached_username = SVN::Client::get_username_provider();
my $git_username = SVN::Client::get_username_prompt_provider(
&username, 2);
my $ctx = new SVN::Client(
auth => [
$cached_simple, $git_simple,
$cached_ssl, $git_ssl,
$cached_cert, $git_cert,
$cached_cert_pw, $git_cert_pw,
$cached_username, $git_username
]);
DESCRIPTION
This module is an implementation detail of the "git svn" command. It implements git-svn's authentication policy. Do not use it unless you
are developing git-svn.
The interface will change as git-svn evolves.
DEPENDENCIES
SVN::Core.
SEE ALSO
SVN::Client.
INCOMPATIBILITIES
None reported.
BUGS
None.
perl v5.16.3 2013-06-10 Git::SVN::Prompt(3)