linux 版菱形
#!/bin/sh
read -p "Input line number: " line
for((i=0;i<$line;i++))
do
for((k=i+1;k<$line;k++))
do
echo -n " "
done
for((j=0;j<$((2*$i+1));j++))
do
echo -n "*"
done
echo
done
for ((i=1; 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