Question: Please write clear. Class is practical unix and programming. 1. Write a bash script named triangletype that expects three positive whole numbers on the command
Please write clear. Class is practical unix and programming.
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 rst 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 displays 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 > c and a2 + b 2 < c2 )
the numbers are the sides of a right triangle, or (a + b > c and a2 + b 2 = c 2 )
the numbers are the sides of an acute triangle (a + b > c and a2 + b 2 > 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
