linux bash shell 在控制台打印 8格棋盘的方法
#!/bin/bash for ((i=1;i<=8;i++)) do for ((j=1;j<=8;j++)) do let "total=($i+$j)" let "tmp=$total%2" if [ $tmp -eq 0 ] then echo -e -n "\033[47m " else echo -e -n "\033[40m " fi done echo -e "\e[0m" done echo -n -e "\e[0m"