Question: 1. Write a bash script named triangletype that expects three positive whole numbers on the command line, in increasing order. In other words, it should

1. Write a bash script named triangletype that expects three positive whole numbers on the command line, in increasing order. In other words, it should be called like this:

$triangletype 3 12 15

The script checks first of all that there are three numbers and that they are all positive, and increasing in value. If either of these conditions is false, it dis- plays a usage message and exits. Suppose we call the entered numbers a, b, and c, in that order. If the user has entered valid numbers, the script determines whether :

the numbers are not the sides of a triangle (a + b c) the numbers are the sides of an obtuse triangle(a+b>canda2+b2 canda2+b2 =c2) the numbers are the sides of an acute triangle(a+b>canda2+b2 >c2)

Exactly one of these conditions must be true. The script should display a message stating which is true. The message should be at most one line long and should include the numbers and indicate what is true about them. For example:

$ triangletype 3 4 5 3, 4, and 5 are the sides of a right triangle

2

Write a bash script named sum that expects one positive whole number on the command line. The script checks first of all that there is one number and that it is positive. If either of these conditions is false, it displays a usage message and exits.

Your script should implement a for loop to calculate the sum from 1 to the number specified in the command line. Do not use a closed form expression such as n(n+1)/2 to do your calculation.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!