more bash examples

This commit is contained in:
Marina Wahl 2014-07-01 19:51:31 -04:00
parent 68e3f7d899
commit 4b0a965e4a
9 changed files with 199 additions and 0 deletions

View file

@ -0,0 +1,18 @@
#! /bin/bash
# script to print a chessboard
for (( i = 1; i <= 9; i++ ))
do
for (( j = 1; j <= 9; 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[40m "
fi
done
echo -e -n "\033[40m" # set to black
echo"" # print new line
done