代码
#!/bin/bash
for ((i=1;i<=5;i++)) #顶头部分
do
for ((j=1;j<=19-$i;j++))
do
echo -n " "
done
for ((k=1;k<=$[$i*2-1];k++))
do
echo -n "*"
done
echo ""
done
for ((i=1;i<=3;i++)) #中间倒梯形
do
for ((j=1;j<=3*$i-2;j++))
do
echo -n " "
done
for ((k=1;k<=41-6*$i;k++))
do
echo -n "*"
done
echo ""
done
for ((i=1;i<=4;i++)) #第二个正梯形
do
for ((j=1;j<=12-3*$i;j++))
do
echo -n " "
done
for ((k=1;k<=12+6*$i;k++))
do
echo -n "*"
done
echo ""
done
for ((i=5;i>=1;i--)) #顶头部分
do
for ((j=1;j<=19-$i;j++))
do
echo -n " "
done
for ((k=1;k<=$[2*$i-1];k++))
do
echo -n "*"
done
echo ""
done