Open a new terminal.
Save the following as a file "chessboard" -
vim chessboard
and paste -
for (( i = 1; i <= 49 ; i++ )) ### Outer for loop ###
do
for (( j = 1 ; j <= 49; j++ )) ### Inner for loop ###
do
tot=`expr $i + $j`
tmp=`expr $tot % 2`
if [ $tmp -eq 0 ]; then
echo -e -n "\033[49m "
else
echo -e -n "\033[40m "
fi
done
echo -e -n "\033[49m" #### set back background colour to black
echo "" #### print the new line ###
done
echo -e -n "\033[49m \n" #### set back background colour to white
Make it executable -
chmod 755 chessboard
Run the script -
./chessboard
The terminal must be maximised.
Stare at the pattern for some time. Does it move ?
Save the following as a file "chessboard" -
vim chessboard
and paste -
for (( i = 1; i <= 49 ; i++ )) ### Outer for loop ###
do
for (( j = 1 ; j <= 49; j++ )) ### Inner for loop ###
do
tot=`expr $i + $j`
tmp=`expr $tot % 2`
if [ $tmp -eq 0 ]; then
echo -e -n "\033[49m "
else
echo -e -n "\033[40m "
fi
done
echo -e -n "\033[49m" #### set back background colour to black
echo "" #### print the new line ###
done
echo -e -n "\033[49m \n" #### set back background colour to white
Make it executable -
chmod 755 chessboard
Run the script -
./chessboard
The terminal must be maximised.
Stare at the pattern for some time. Does it move ?
Comments