The following bash one-liner will print a chess board in a terminal (the script works for the shells bash and ksh only)
for (( i = 1; i <= 8 ; i++ )); do for (( j = 1 ; j <= 8; j++ )); do tot=`expr $i + $j`; tmp=`expr $tot % 2`; if [ $tmp -eq 0 ]; then echo -e -n "\033[47m "; else echo -e -n "\033[49m "; fi; done; echo -e -n "\033[49m"; echo "" ; done; echo -e -n "\033[49m \n"
for (( i = 1; i <= 8 ; i++ )); do for (( j = 1 ; j <= 8; j++ )); do tot=`expr $i + $j`; tmp=`expr $tot % 2`; if [ $tmp -eq 0 ]; then echo -e -n "\033[47m "; else echo -e -n "\033[49m "; fi; done; echo -e -n "\033[49m"; echo "" ; done; echo -e -n "\033[49m \n"
Comments