zero/home-environments/radio/files/.local/bin/xkcd

14 lines
313 B
Bash
Executable File

#!/bin/sh
if [ $# -gt 0 ] && [ $1 = "-r" ]; then
URL=https://c.xkcd.com/random/comic
else
URL=https://xkcd.com/
fi
URL=$(curl -s -L $URL \
| grep 'href= "https://imgs.xkcd.com/comics.*' \
| cut -d'>' -f2 \
| cut -d'<' -f1)
curl $URL --output /tmp/xkcd 2>/dev/null
chafa /tmp/xkcd