#!/bin/bash read -p "Input line number: " line for ((i=0; i<$line; i++)) do for ((k=$i; k>0; k--)) do echo -n " " done for ((h=$((2*($line-$i)-1)); h>0; h--)) do echo -n "*" done echo done
#!/bin/bash read -p "Input line number: " line for ((i=0; i<$line; i++)) do for ((k=$i; k>0; k--)) do echo -n " " done for ((h=$((2*($line-$i)-1)); h>0; h--)) do echo -n "*" done echo done
原文:https://www.cnblogs.com/springcloud/p/8168962.html