for ((i=1;i<=9;i++))
do
for ((j=1;j<=i;j++))
do
echo -n "*"
done
echo ""
done
i=1
while [ $i -le 9 ]
do
j=1
while [ $j -le $i ]
do
echo -n "*"
let j++
done
let i++
echo ""
done
for ((i=1;i<=9;i++))
do
for((j=9;j>=i;j--))
do
echo -n "*"
done
echo ""
done
i=1
while [ $i -le 9 ]
do
j=9
while [ $j -ge $i ]
do
echo -n "*"
let j--
done
let i++
echo ""
done
for ((i=1;i<=9;i++))
do
for ((j=9;j>=i;j--))
do
echo -n " "
done
for ((k=1;k<=i;k++))
do
echo -n "*"
done
echo ""
done
i=1
while [ $i -le 9 ]
do
k=9
while [ $k -ge $i ]
do
echo -n " "
let k--
done
j=1
while [ $j -le $i ]
do
echo -n "*"
let j++
done
echo ""
let i++
done
for ((i=1;i<=9;i++))
do
for ((k=1;k<=i;k++))
do
echo -n " "
done
for ((j=9;j>=i;j--))
do
echo -n "*"
done
echo ""
done
i=1
while [ $i -le 9 ]
do
j=1
while [ $j -le $i ]
do
echo -n " "
let j++
done
k=9
while [ $k -ge $i ]
do
echo -n "*"
let k--
done
echo ""
let i++
done
for ((i=1;i<=9;i++))
do
for ((k=9;k>=i;k--))
do
echo -n " "
done
a=$[$i*2-1]
for ((j=1;j<=$a;j++))
do
echo -n "*"
done
echo ""
done
for ((i=9;i>=1;i--))
do
for ((k=9;k>=i;k--))
do
echo -n " "
done
a=$[$i*2-1]
for ((j=1;j<=$a;j++))
do
echo -n "*"
done
echo ""
done
for ((i=1;i<=9;i++))
do
for ((k=9;k>=i;k--))
do
echo -n " "
done
a=$[$i*2-1]
for ((j=1;j<=$a;j++))
do
echo -n "*"
done
echo ""
done
for ((i=8;i>=1;i--))
do
for ((k=9;k>=i;k--))
do
echo -n " "
done
a=$[$i*2-1]
for ((j=1;j<=$a;j++))
do
echo -n "*"
done
echo ""
done
for ((i=1;i<=10;i++))
do
for ((j=1;j<=20;j++))
do
echo -n "*"
done
echo ""
done
for ((i=1;i<=10;i++))
do
if [ $i -eq 1 -o $i -eq 10 ];then
for ((j=1;j<=20;j++))
do
echo -n "*"
done
echo ""
else
echo -n "*"
for ((k=1;k<=18;k++))
do
echo -n " "
done
echo "*"
fi
done
for ((i=1;i<=9;i++))
do
for ((j=9;j>=i;j--))
do
echo -n " "
done
for ((k=1;k<=9;k++))
do
echo -n "*"
done
echo ""
done
for ((i=1;i<=9;i++))
do
for ((j=1;j<=i;j++))
do
echo -n " "
done
for ((k=1;k<=9;k++))
do
echo -n "*"
done
echo ""
done
for ((i=1;i<=9;i++))
do
for ((j=9;j>=i;j--))
do
echo -n " "
done
for ((k=1;k<=9+$i;k++))
do
echo -n "*"
done
echo ""
done
注:倒直角梯形同理,这边就不再阐述了
for ((i=1;i<=9;i++))
do
for ((j=9;j>=i;j--))
do
echo -n " "
done
for ((k=1;k<=9+$i;k++))
do
echo -n "*"
done
for ((g=1;g<=i;g++))
do
echo -n "*"
done
echo ""
done
原文:https://www.cnblogs.com/guxd/p/15031814.html