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.www58058.com/38047
標題命令不夠規范,需要按格式寫,不要帶日期,練習等字眼