Below are the steps to draw chess board on terminal
1- Create a file name chessboard.sh and write below code in.
#!/bin/bash
# Author : LEOxian
# License: GPLv2
# Description: Chess Board
# Date : 20-March-2012
for (( i=1; i<10; i++ ))
do
for (( j=1; j<10; j++ ))
do
value1=$(expr $j + $i )
value2=$(expr $value1 % 2)
if [ "$value2" -eq 0 ]
then
echo -e -n "\033[49m "
else
echo -e -n "\033[40m "
fi
done
echo -e "\033[49m "
done
2- Copy Complete below written script in the file created and save it.
3- Set executable permission – “chmod a+x chessboard.sh .
4- Run script like ./chessboard.sh which will draw chess board on terminal.
Note: Run script on terminal with white background.
Output-