How do i make this script print out multiple boxes?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have this script that prints out a box frame with Asterisk signs, and I need to make it so that the script prints out multiple boxes under each other. How can I do it?



#!/bin/bash
#
echo -n "Please enter the amount of lines: "
read lines
echo -n "Please enter the amount of *: "
read sign
for((i = 1; i <= $lines; i++))
do
echo -n "$i "
if [ $i -eq 1 -o $i -eq $lines ]; then
for((j = 1; j <= $sign; j++))
do
echo -n "* "
done

else
echo -n "* "
for((j = 2; j < $sign; j++))
do
echo -n " "
done
echo -n "* "
fi
echo
done
#end






share|improve this question





















  • Just run the code in a loop? Also, this question, or a similar one, came up recently. Is it homework? Are you later supposed to add a star in the center of the box like this person wanted? Don't output individual characters in loops, it's horribly inefficient.
    – Kusalananda
    May 29 at 6:59











  • pretty much yes, i keep overthinking to get the answer.
    – MargusL
    May 29 at 8:53














up vote
0
down vote

favorite












I have this script that prints out a box frame with Asterisk signs, and I need to make it so that the script prints out multiple boxes under each other. How can I do it?



#!/bin/bash
#
echo -n "Please enter the amount of lines: "
read lines
echo -n "Please enter the amount of *: "
read sign
for((i = 1; i <= $lines; i++))
do
echo -n "$i "
if [ $i -eq 1 -o $i -eq $lines ]; then
for((j = 1; j <= $sign; j++))
do
echo -n "* "
done

else
echo -n "* "
for((j = 2; j < $sign; j++))
do
echo -n " "
done
echo -n "* "
fi
echo
done
#end






share|improve this question





















  • Just run the code in a loop? Also, this question, or a similar one, came up recently. Is it homework? Are you later supposed to add a star in the center of the box like this person wanted? Don't output individual characters in loops, it's horribly inefficient.
    – Kusalananda
    May 29 at 6:59











  • pretty much yes, i keep overthinking to get the answer.
    – MargusL
    May 29 at 8:53












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have this script that prints out a box frame with Asterisk signs, and I need to make it so that the script prints out multiple boxes under each other. How can I do it?



#!/bin/bash
#
echo -n "Please enter the amount of lines: "
read lines
echo -n "Please enter the amount of *: "
read sign
for((i = 1; i <= $lines; i++))
do
echo -n "$i "
if [ $i -eq 1 -o $i -eq $lines ]; then
for((j = 1; j <= $sign; j++))
do
echo -n "* "
done

else
echo -n "* "
for((j = 2; j < $sign; j++))
do
echo -n " "
done
echo -n "* "
fi
echo
done
#end






share|improve this question













I have this script that prints out a box frame with Asterisk signs, and I need to make it so that the script prints out multiple boxes under each other. How can I do it?



#!/bin/bash
#
echo -n "Please enter the amount of lines: "
read lines
echo -n "Please enter the amount of *: "
read sign
for((i = 1; i <= $lines; i++))
do
echo -n "$i "
if [ $i -eq 1 -o $i -eq $lines ]; then
for((j = 1; j <= $sign; j++))
do
echo -n "* "
done

else
echo -n "* "
for((j = 2; j < $sign; j++))
do
echo -n " "
done
echo -n "* "
fi
echo
done
#end








share|improve this question












share|improve this question




share|improve this question








edited May 29 at 7:46









Marco

750516




750516









asked May 29 at 6:43









MargusL

31




31











  • Just run the code in a loop? Also, this question, or a similar one, came up recently. Is it homework? Are you later supposed to add a star in the center of the box like this person wanted? Don't output individual characters in loops, it's horribly inefficient.
    – Kusalananda
    May 29 at 6:59











  • pretty much yes, i keep overthinking to get the answer.
    – MargusL
    May 29 at 8:53
















  • Just run the code in a loop? Also, this question, or a similar one, came up recently. Is it homework? Are you later supposed to add a star in the center of the box like this person wanted? Don't output individual characters in loops, it's horribly inefficient.
    – Kusalananda
    May 29 at 6:59











  • pretty much yes, i keep overthinking to get the answer.
    – MargusL
    May 29 at 8:53















Just run the code in a loop? Also, this question, or a similar one, came up recently. Is it homework? Are you later supposed to add a star in the center of the box like this person wanted? Don't output individual characters in loops, it's horribly inefficient.
– Kusalananda
May 29 at 6:59





Just run the code in a loop? Also, this question, or a similar one, came up recently. Is it homework? Are you later supposed to add a star in the center of the box like this person wanted? Don't output individual characters in loops, it's horribly inefficient.
– Kusalananda
May 29 at 6:59













pretty much yes, i keep overthinking to get the answer.
– MargusL
May 29 at 8:53




pretty much yes, i keep overthinking to get the answer.
– MargusL
May 29 at 8:53










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










If you just want the number of boxes as an input, it is just:



#!/bin/bash
#
echo -n "Please enter the amount of lines: "
read lines
echo -n "Please enter the amount of *: "
read sign
echo -n "Please enter the amount of boxes: "
read boxes
for ((h = 1; h <= $boxes; h++))
do
for((i = 1; i <= $lines; i++))
do
echo -n "$i "
if [ $i -eq 1 -o $i -eq $lines ]; then
for((j = 1; j <= $sign; j++))
do
echo -n "* "
done
else
echo -n "* "
for((j = 2; j < $sign; j++))
do
echo -n " "
done
echo -n "* "
fi
echo
done
done
#end


Not sure whether this is what you want though, because if you wrote your code you should have probably figured it out.






share|improve this answer























  • i keep overthinking and i was curious to find out a simple way
    – MargusL
    May 29 at 8:54










  • Thank you for your help, now i understand and possibly do not overthink.
    – MargusL
    May 29 at 8:57










  • No problem. I guess this was the simplest way to extend exactly what you were doing in the way you were doing it. Feel free to accept the answer if you think it was what you needed :)
    – myradio
    May 29 at 9:00










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446614%2fhow-do-i-make-this-script-print-out-multiple-boxes%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










If you just want the number of boxes as an input, it is just:



#!/bin/bash
#
echo -n "Please enter the amount of lines: "
read lines
echo -n "Please enter the amount of *: "
read sign
echo -n "Please enter the amount of boxes: "
read boxes
for ((h = 1; h <= $boxes; h++))
do
for((i = 1; i <= $lines; i++))
do
echo -n "$i "
if [ $i -eq 1 -o $i -eq $lines ]; then
for((j = 1; j <= $sign; j++))
do
echo -n "* "
done
else
echo -n "* "
for((j = 2; j < $sign; j++))
do
echo -n " "
done
echo -n "* "
fi
echo
done
done
#end


Not sure whether this is what you want though, because if you wrote your code you should have probably figured it out.






share|improve this answer























  • i keep overthinking and i was curious to find out a simple way
    – MargusL
    May 29 at 8:54










  • Thank you for your help, now i understand and possibly do not overthink.
    – MargusL
    May 29 at 8:57










  • No problem. I guess this was the simplest way to extend exactly what you were doing in the way you were doing it. Feel free to accept the answer if you think it was what you needed :)
    – myradio
    May 29 at 9:00














up vote
0
down vote



accepted










If you just want the number of boxes as an input, it is just:



#!/bin/bash
#
echo -n "Please enter the amount of lines: "
read lines
echo -n "Please enter the amount of *: "
read sign
echo -n "Please enter the amount of boxes: "
read boxes
for ((h = 1; h <= $boxes; h++))
do
for((i = 1; i <= $lines; i++))
do
echo -n "$i "
if [ $i -eq 1 -o $i -eq $lines ]; then
for((j = 1; j <= $sign; j++))
do
echo -n "* "
done
else
echo -n "* "
for((j = 2; j < $sign; j++))
do
echo -n " "
done
echo -n "* "
fi
echo
done
done
#end


Not sure whether this is what you want though, because if you wrote your code you should have probably figured it out.






share|improve this answer























  • i keep overthinking and i was curious to find out a simple way
    – MargusL
    May 29 at 8:54










  • Thank you for your help, now i understand and possibly do not overthink.
    – MargusL
    May 29 at 8:57










  • No problem. I guess this was the simplest way to extend exactly what you were doing in the way you were doing it. Feel free to accept the answer if you think it was what you needed :)
    – myradio
    May 29 at 9:00












up vote
0
down vote



accepted







up vote
0
down vote



accepted






If you just want the number of boxes as an input, it is just:



#!/bin/bash
#
echo -n "Please enter the amount of lines: "
read lines
echo -n "Please enter the amount of *: "
read sign
echo -n "Please enter the amount of boxes: "
read boxes
for ((h = 1; h <= $boxes; h++))
do
for((i = 1; i <= $lines; i++))
do
echo -n "$i "
if [ $i -eq 1 -o $i -eq $lines ]; then
for((j = 1; j <= $sign; j++))
do
echo -n "* "
done
else
echo -n "* "
for((j = 2; j < $sign; j++))
do
echo -n " "
done
echo -n "* "
fi
echo
done
done
#end


Not sure whether this is what you want though, because if you wrote your code you should have probably figured it out.






share|improve this answer















If you just want the number of boxes as an input, it is just:



#!/bin/bash
#
echo -n "Please enter the amount of lines: "
read lines
echo -n "Please enter the amount of *: "
read sign
echo -n "Please enter the amount of boxes: "
read boxes
for ((h = 1; h <= $boxes; h++))
do
for((i = 1; i <= $lines; i++))
do
echo -n "$i "
if [ $i -eq 1 -o $i -eq $lines ]; then
for((j = 1; j <= $sign; j++))
do
echo -n "* "
done
else
echo -n "* "
for((j = 2; j < $sign; j++))
do
echo -n " "
done
echo -n "* "
fi
echo
done
done
#end


Not sure whether this is what you want though, because if you wrote your code you should have probably figured it out.







share|improve this answer















share|improve this answer



share|improve this answer








edited May 29 at 8:55


























answered May 29 at 6:57









myradio

1885




1885











  • i keep overthinking and i was curious to find out a simple way
    – MargusL
    May 29 at 8:54










  • Thank you for your help, now i understand and possibly do not overthink.
    – MargusL
    May 29 at 8:57










  • No problem. I guess this was the simplest way to extend exactly what you were doing in the way you were doing it. Feel free to accept the answer if you think it was what you needed :)
    – myradio
    May 29 at 9:00
















  • i keep overthinking and i was curious to find out a simple way
    – MargusL
    May 29 at 8:54










  • Thank you for your help, now i understand and possibly do not overthink.
    – MargusL
    May 29 at 8:57










  • No problem. I guess this was the simplest way to extend exactly what you were doing in the way you were doing it. Feel free to accept the answer if you think it was what you needed :)
    – myradio
    May 29 at 9:00















i keep overthinking and i was curious to find out a simple way
– MargusL
May 29 at 8:54




i keep overthinking and i was curious to find out a simple way
– MargusL
May 29 at 8:54












Thank you for your help, now i understand and possibly do not overthink.
– MargusL
May 29 at 8:57




Thank you for your help, now i understand and possibly do not overthink.
– MargusL
May 29 at 8:57












No problem. I guess this was the simplest way to extend exactly what you were doing in the way you were doing it. Feel free to accept the answer if you think it was what you needed :)
– myradio
May 29 at 9:00




No problem. I guess this was the simplest way to extend exactly what you were doing in the way you were doing it. Feel free to accept the answer if you think it was what you needed :)
– myradio
May 29 at 9:00












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446614%2fhow-do-i-make-this-script-print-out-multiple-boxes%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay