0% found this document useful (0 votes)
3 views1 page

Bash Loop Echo Script Example

This Bash script uses nested for loops to print increasing numbers on each new line. The outer loop iterates from 1 to 5, while the inner loop prints the current number from the outer loop the same number of times on each line. Each line prints from 1 to the line number, with an empty line after to separate each row of output.

Uploaded by

KuldeepMis
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Bash Loop Echo Script Example

This Bash script uses nested for loops to print increasing numbers on each new line. The outer loop iterates from 1 to 5, while the inner loop prints the current number from the outer loop the same number of times on each line. Each line prints from 1 to the line number, with an empty line after to separate each row of output.

Uploaded by

KuldeepMis
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

echo "Can you see the following:"

for (( i=1; i<=5; i++ ))


do
for (( j=1; j<=i; j++ ))
do
echo -n "$i"
done
echo ""

You might also like