Linux Shell Programming print shape

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/shuai0845/article/details/86532293

Print triangle

topic:

Shell write a program to print a (long asterisk on behalf of a unit of a side) by the "*" is composed of an equilateral triangle side length of the upright 8.
Enter Caption

#/bin/bash
length=8
for ((i=1; i<=$length; i++))
do
	for ((j=1; j<=$length-i; j++))
	do
		echo -n  " "
	done
	for ((x=1; x<=i; x++))
	do
		echo -n  "* "
	done
	echo ""
done

Guess you like

Origin blog.csdn.net/shuai0845/article/details/86532293