1、写个脚本,实现以下三角形
* *** ***** ******* #!/bin/bash # read -p " input a number : " n for l in $(seq $n);do for i in $(seq $[$n-$l]);do echo -n " " done for j in $(seq $[$l*2-1]);do echo -n "*" done echo done
2、用until循环实现国际象棋棋盘
#!/bin/bash # declare -i i=1 while [ $i -le 8 ];do j=1 while [ $j -le 8 ];do sum=$[$i+$j] z=$[$sum%2] if [ $z -eq 0 ];then echo -en "\e[40;1m \e[0m" else echo -en "\e[47;1m \e[0m" fi let j++ done echo let i++ done
原创文章,作者:pao,如若转载,请注明出处:http://www.178linux.com/38047
评论列表(1条)
标题命令不够规范,需要按格式写,不要带日期,练习等字眼