Shell——图形
目录
#!/bin/bash for ((i=1; i<=20; i++)) do echo -n "*" if [ $i -eq 20 ];then echo "" fi done
#!/bin/bash for ((i=1; i<=10; i++)) do if [ $i -eq 1 -o $i -eq 10 ];then for ((j=1; j<=20; j++)) do echo -n "*" done echo "" else echo -n "*" for ((k=1; k<=18; k++)) do echo -n " " done echo "*" fi done
#!/bin/bash for ((i=1; i<=9; i++)) do for ((j=1; j<=$i; j++)) do echo -n "*" done echo "" done
#!/bin/bash for ((i=1; i<=9; i++)) do for ((j=9; j>=i; j--)) do echo -n "*" done echo "" done
#!/bin/bash for ((i=1; i<=9; i++)) do for((j=9; j>=i; j--)) do echo -n " " done for((k=1; k<=i; k++)) do echo -n "*" done echo "" done
#!/bin/bash read -p "请输入大小的数字:" n for ((i=1; i<=$n; i++)) do for ((j=$n; j>=i; j--)) do echo -n " " done for ((k=1; k<=$[$i*2 - 1]; k++)) do echo -n "*" done echo "" done for ((i=$[$n - 1]; i>=1; i--)) do for ((j=$n; j>=i; j--)) do echo -n " " done for ((k=1; k<=$i; k++)) do echo -n "*" done for ((g=2; g<=$i; g++)) do echo -n "*" done echo "" done
#!/bin/bash for ((i=1; i<=6; i++)) do for ((j=6; j>=i; j--)) do echo -n " " done for ((k=1; k<=6; k++)) do echo -n "*" done for ((g=1; g<=i; g++)) do echo -n "*" done echo "" done