Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a bash script called example3A.sh that prints a rectangle with the height

ID: 3873300 • Letter: W

Question

Write a bash script called example3A.sh that prints a rectangle with the height
and width dimensions given from two parameters passed as command line
arguments. The syntax is as follows:

example3A.sh height width

The mandatory integral parameters height and width must be greater than 1, but can be any reasonable integral value (as long as the terminal supports it). If any of the parameters are less than 2, you are to display a meaningful error message and terminate the program. If no, two few, or too many arguments, are given, you are to display an appropriate usage statement, such as usage: ./example3A.sh height width, and terminate the program

Explanation / Answer

#if else condition to check the number of arguments provided
if[ $# -eq 2 ]
then
echo "Rectangle with Height: "$1"and Width: "$2
else
echo "Incorrect argument passed.USAGE: ./example3A.sh height width"
fi

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote