Chess Board

CHESS BOARD

How to Use this script

Step-1  Create a file name it  'chessboard.sh'

Step-2  Copy Complete below written script in the file created and save it.

Step-3  Set executable permission by runing following command ( [ root @ server1~ ]#  chmod   a+x   chessboard.sh ) .

Step-4  Run script like  ./chessboard.sh  which will draw chess board on terminal.

#!/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[47m  "
else
echo -e -n "\033[40m  "
fi
done
echo -e "\033[47m  "
done
 
 
Cheers!!!