Public feed #601748

Something

public text v1 · immutable
Raw Edit
·published 2007-07-03 18:09 UTC
rendered paste body
# ogni 30 secondi controlla se c'e' stato uno o piu' eventi che
# hanno interrotto l'harvesting, e lo segnala con un messaggio.
# Usl 23/6/2007, dedicato a Birebbi :)
# Piro 03/07/2007

file=$HOME/.elc/chat_log.txt
msg1="Sveglia $LOGNAME, e' ora di spalare!"
msg2="Occhio $LOGNAME, hai rotto qualcosa!"
msg3="Ollee $LOGNAME, hai livellato qualcosa!"
cnth=0
prevh=0
cnt1=0
prev1=0
cnt2=0
prev3=0
cnt3=0
prev2=0

while true
do

	cnth=`grep -c "You stopped harvesting\." $file`
	if [ $cnth -ne $prevh ]
	then
		echo "$msg1"
		beep -f 1000 -n -f 2000 -n -f 1500
	fi
	prevh=$cnth

	cnt1=`grep -c "has been degraded" $file`
	if [ $cnt3 -ne $prev3 ]
	then
		echo "$msg2"
		beep -f 2000 -n -f 1000 -n -f 800
	fi
	
	cnt1=`grep -c "has been destroyed" $file`
	if [ $cnt1 -ne $prev1 ]
	then
		echo "$msg2"
		beep -f 2000 -n -f 1000 -n -f 800
	fi
	prev1=$cnt1

	cnt2=`grep -c "You advanced to level" $file`
	if [ $cnt2 -ne $prev2 ]
	then
		echo "$msg3"
		beep -f 1500 -n -f 1500 -n -f 2000
	fi
	prev2=$cnt2



	sleep 30s
done