Tuesday, May 03, 2005

Dancing bars

while true; do if(( count % 2 == 0)); then tput clear; echo '\'; else tput clear ;echo "/"; fi; ((count++)); done

Now i'll use switch case

#!/bin/sh

printbar()
{
case $1 in
'0') echo "/";;
'1') echo "|";;
'2') echo '\';;
'3') echo "-";;
'4') echo "|";;
'5') echo '\';;
'6') echo "-";;
*) echo "not found";;
esac
}
clear
count=0
while true
do
tput cup 10 10
printbar $(($count % 7))
(( count++ ))
done

0 Comments:

Post a Comment

<< Home