Shell和C輸出黑白棋盤:
#!/bin/bash
for((i=1;i<=8;i++))
do
for((j=1;j<=8;j++))
do
total=$(($i+$j))
tmp=$(($total%2))
if [ $tmp -eq 0 ]
then
echo -e -n "\033[47m \033[0m"
else
echo -e -n "\033[40m \033[0m"
fi
done
echo ""
done