Skip to content

Instantly share code, notes, and snippets.

@thingsiplay
Last active August 31, 2022 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thingsiplay/c057daf97e3b7fc2031a9344552444e4 to your computer and use it in GitHub Desktop.
Save thingsiplay/c057daf97e3b7fc2031a9344552444e4 to your computer and use it in GitHub Desktop.
Print current GAME ROW.
#!/usr/bin/bash
# Print current GAME ROW.
# https://www.reddit.com/r/gamerow/comments/u9587m/rgamerow_lounge/
link="https://thingsiplay.eu.pythonanywhere.com/game-random-of-the-week"
if [ $# -eq 0 ]
then
curl -s "$link" \
| sed 's/<[^>]\+>//g' \
| sed -E '/^$|Discussion/d' \
| sed -E 's/: html,.+|Week://g' \
| sed -z 's/\n//'
else
if [ "$1" == "--help" ]
then
echo "Usage:"
echo " $(basename "$0") [system] [head]"
echo ""
echo "Examples:"
echo " $(basename "$0")"
echo " $(basename "$0") nes"
echo " $(basename "$0") nes name"
elif [ $# -eq 1 ]
then
curl -f -s "$link/$1"
else
curl -f -s "$link/$1" | awk -F': ' "/^$2/{print \$2}"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment