Question: How to write a bash shell script that prints a hollow box after user enters number of lines, ie bash hbox 4 , prints: ****

How to write a bash shell script that prints a hollow box after user enters number of lines, ie "bash hbox 4" , prints:

**** * * * * ****

My code doesnt work. i need it to take in the argument from the command line: ./hbox 4 "*"

echo "Enter number of rows" read sz

clear

for (( x = 1; x <= $sz; x++ )); do for (( y = 1; y <= $sz; y++ )); do if [ "$x" == 1 ] || [ "$x" == "$sz" ] || [ "$y" == 1 ] || [ "$y" == "$sz" ] then echo "* " else echo " " fi done echo -ne "" done

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!