Question: Hello, this is a practice script for my Intro to Linux class using BASH. Thank you in advance Script 2 | The Triangle For this

Hello, this is a practice script for my Intro to Linux class using BASH. Thank you in advance

Script 2 | The Triangle

For this script we are going to take in a number via a command line argument. We are then going to draw a triangle facing right the size of the number the user entered by counting up and then counting back down (See the test cases to get a better picture of what I mean). For this script you will need to

Name This Script: triangle

Take an integer via a command line argument (DO NOT PROMPT THE USER FOR A NUMBER)

If a number is not given when executing the script, error out and alert to the user that they must provide a

number. Use exit code 10 if this occurs

Using a for loop, construct the loop that will echo out the spear

Depending on the number you are on, that is what will be echoed out. For Example:

If we are at integer 5. The following will be echoed out: 55555

You will need to nest a loop within a loop. Multiple loops will be required to complete the assignment

Limit the inputted integer to be no bigger than 10. If violated, alert and exit with exit code 20.

IT SHOULD LOOK LIKE THIS:

$ ./triangle ERROR | You must provide an integer as an argument Example: ./triangle 5

$ echo $? 10

$ ./triangle 11 ERROR | Integer Too Big You can only use a number that is less than or equal to 10.

$ echo $? 20

$ ./triangle 4

1

22

333

4444

333

22

1

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!