实验 shell-菱形

#!/bin/bash
read -p “请输入行数:” zk
for ((i=0;i< z k ; i + + ) ) d o f o r ( ( j = zk;i++)) do for((j= zk;i++))dofor((j=zk;j>i+1;j–))
do
echo -ne " "
done
for ((n=2i+1;n>0;n–))
do
echo -ne "
"
done
echo
done
for((i= z k ; i > 0 ; i − − ) ) d o f o r ( ( j = zk;i>0;i--)) do for((j= zk;i>0;i))dofor((j=zk-1;j>=i;j–))
do
echo -ne " "
done
for((n=0;n<2i-1;n++))
do
echo -ne "
"
done
echo
done
实验 shell-菱形_第1张图片

你可能感兴趣的:(Linux)