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
ARITH3(9.2)															       ARITH3(9.2)

NAME
add3, sub3, div3, mul3, eqpt3, closept3, dot3, cross3, len3, dist3, unit3, midpt3, lerp3, reflect3, nearseg3, pldist3, vdiv3, vrem3, pn2f3, ppp2f3, fff2p3, pdiv4, add4, sub4 - operations on 3-d points and planes SYNOPSIS
#include <libg.h> #include <geometry.h> Point3 add3(Point3 a, Point3 b) Point3 sub3(Point3 a, Point3 b) Point3 div3(Point3 a, double b) Point3 mul3(Point3 a, double b) int eqpt3(Point3 p, Point3 q) int closept3(Point3 p, Point3 q, double eps) double dot3(Point3 p, Point3 q) Point3 cross3(Point3 p, Point3 q) double len3(Point3 p) double dist3(Point3 p, Point3 q) Point3 unit3(Point3 p) Point3 midpt3(Point3 p, Point3 q) Point3 lerp3(Point3 p, Point3 q, double alpha) Point3 reflect3(Point3 p, Point3 p0, Point3 p1) Point3 nearseg3(Point3 p0, Point3 p1, Point3 testp) double pldist3(Point3 p, Point3 p0, Point3 p1) double vdiv3(Point3 a, Point3 b) Point3 vrem3(Point3 a, Point3 b) Point3 pn2f3(Point3 p, Point3 n) Point3 ppp2f3(Point3 p0, Point3 p1, Point3 p2) Point3 fff2p3(Point3 f0, Point3 f1, Point3 f2) Point3 pdiv4(Point3 a) Point3 add4(Point3 a, Point3 b) Point3 sub4(Point3 a, Point3 b) DESCRIPTION
These routines do arithmetic on points and planes in affine or projective 3-space. Type Point3 is typedef struct Point3 Point3; struct Point3{ double x, y, z, w; }; Routines whose names end in 3 operate on vectors or ordinary points in affine 3-space, represented by their Euclidean (x,y,z) coordinates. (They assume w=1 in their arguments, and set w=1 in their results.) Name Description add3 Add the coordinates of two points. sub3 Subtract coordinates of two points. mul3 Multiply coordinates by a scalar. div3 Divide coordinates by a scalar. eqpt3 Test two points for exact equality. closept3 Is the distance between two points smaller than eps? dot3 Dot product. cross3 Cross product. len3 Distance to the origin. dist3 Distance between two points. unit3 A unit vector parallel to p. midpt3 The midpoint of line segment pq. lerp3 Linear interpolation between p and q. reflect3 The reflection of point p in the segment joining p0 and p1. nearseg3 The closest point to testp on segment p0 p1. pldist3 The distance from p to segment p0 p1. vdiv3 Vector divide -- the length of the component of a parallel to b, in units of the length of b. vrem3 Vector remainder -- the component of a perpendicular to b. Ignoring roundoff, we have eqpt3(add3(mul3(b, vdiv3(a, b)), vrem3(a, b)), a). The following routines convert amongst various representations of points and planes. Planes are represented identically to points, by duality; a point p is on a plane q whenever p.x*q.x+p.y*q.y+p.z*q.z+p.w*q.w=0. Although when dealing with affine points we assume p.w=1, we can't make the same assumption for planes. The names of these routines are extra-cryptic. They contain an f (for `face') to indicate a plane, p for a point and n for a normal vector. The number 2 abbreviates the word `to.' The number 3 reminds us, as before, that we're dealing with affine points. Thus pn2f3 takes a point and a normal vector and returns the corresponding plane. Name Description pn2f3 Compute the plane passing through p with normal n. ppp2f3 Compute the plane passing through three points. fff2p3 Compute the intersection point of three planes. The names of the following routines end in 4 because they operate on points in projective 4-space, represented by their homogeneous coordi- nates. pdiv4 Perspective division. Divide p.w into p's coordinates, converting to affine coordinates. If p.w is zero, the result is the same as the argument. add4 Add the coordinates of two points. sub4 Subtract the coordinates of two points. SOURCE
/sys/src/libgeometry SEE ALSO
tstack(9.2) BUGS
Spotty coverage. ARITH3(9.2)