Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions