Skip to content

Instantly share code, notes, and snippets.

@chuckwagoncomputing
Created February 27, 2014 01:41
Show Gist options
  • Save chuckwagoncomputing/9242607 to your computer and use it in GitHub Desktop.
Save chuckwagoncomputing/9242607 to your computer and use it in GitHub Desktop.
Selects the proper xkcd now image file for the time.
#!/bin/bash
# Change this to the directory containing the image files.
XKCDPATH="/usr/local/bin/xkcdnow"
HOUR=$(TZ=Asia/Kamchatka date +%H)
MINUTE=$(date +%M)
if [ $MINUTE -gt 00 -a $MINUTE -le 15 ]; then
MINUTE=15
elif [ $MINUTE -gt 15 -a $MINUTE -le 30 ]; then
MINUTE=30
elif [ $MINUTE -gt 30 -a $MINUTE -le 45 ]; then
MINUTE=45
elif [ $MINUTE -gt 45 -o $MINUTE = 00 ]; then
MINUTE=00
fi
echo $XKCDPATH$HOUR"h"$MINUTE"m.png"
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment