Thanks for the help. I got my script to work. I think it looks a lot cleaner then the bunch of nested ifs and loops.
This is the full script that works.
Code:
#!/bin/bash
#tlight
#towardstheedge
#nov 2012
clear
var1=0
while [ -f .tlight.run ]
do
case 1 in
$(( var1 < 4 )) )
echo "Green"
;;
$(( var1 < 6 )) )
echo "Yellow"
;;
$(( var1 < 10 )) )
echo "Red"
;;
$(( var1 > 9 )) )
echo "Green"
var1=0
;;
*) echo I got here somehow
#used for debugging
esac
((var1++))
sleep 1
done
There is one piece that still puzzles me:
I don't understand how bash is reading that line. I tried substituting different things for the '1' to see what it would do. I don't get how the 1 relates to any of the rest of the script.
Thanks again for the help.