mirror of
https://github.com/autistic-symposium/shell-whiz-toolkit.git
synced 2025-05-12 11:42:20 -04:00
more bash examples
This commit is contained in:
parent
68e3f7d899
commit
4b0a965e4a
9 changed files with 199 additions and 0 deletions
18
shell_scripts/lessons/cheesboard.sh
Executable file
18
shell_scripts/lessons/cheesboard.sh
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue