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.
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.
#/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