?

Log in

No account? Create an account

Previous Entry | Next Entry

A CHESS board

Using BASH, here I present before you a chess board, :-) 



The Code for generating the above chess board is :

#!/bin/sh

for m in `seq 8` ### Outer for loop ###
        do
                for n in `seq 8` ### Inner for loop ###
                        do
                                T=`expr $m + $n`
                                S=`expr $T % 2`
                                        if [ $S -eq 0 ]; then
                                                echo -e -n "\033[47m " ### white ###
                                        else
                                                echo -e -n "\033[40m " ### black ###
                                        fi
                        done
                echo -e -n "\033[40m" #### background colour=black ###
                echo "" #### printing new line ###
        done

 

Profile

jaduks
Jadu Kumar Saikia

Latest Month

January 2008
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  
Powered by LiveJournal.com
Designed by chasethestars