#!/bin/bash
read -p "input the length: " n
for i in `seq 1 $n`
do
for ((j=$n;j>=$i;j--))
do
echo -n " "
done
for((m=1;m<=$i;m++))
do
echo -n "* "
done
echo
done
for i in `seq 1 $n`
do
for((j=0;j<=$i;j++))
do
echo -n " "
done
for((k=$i;k<$n;k++))
do
echo -n "* "
done
echo
done
结果: