#!/bin/bash if [ $# != 1 ] then echo "usage: 1.sh # (#>1) " exit 1 else for ((i=1;i<=$1;i++)) do for ((j=$i;j<=$1;j++)) do echo -n " " done for ((k=1;k<=$i;k++)) do echo -n " " done echo done i1=$[$1/2] //确定 for ((i=1;i<=$i1;i++)) do j1=$[($12-1)/2+1-$1/4] for ((j=1;j<=$j1;j++)) do echo -n " " done k1=$[$1-$j1+1] for ((k=1;k<=$k1;k++)) do echo -n "* " done echo done fi