Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Update pidgin status message periodically with a countdown timer.
#!/bin/bash
upto=`date -d "Mar 30 14:30" +%s`
text="to go!"
while true; do
now=`date +%s`
count=`expr $upto - $now`
hours=`expr $count / 3600`
minutes=`expr $count % 3600 / 60`
if [ "$hours" -gt "0" ] ; then
if [ "$minutes" -gt "0" ] ; then
msg=$hours" Hour(s) "$minutes" Minute(s) ";
else
msg=$hours" Hour(s) ";
fi
else
msg=$minutes" Minute(s) ";
fi
status=$msg$text
echo $status
`purple-remote setstatus?message="$status"`
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.