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

14 lines
313 B
Plaintext
Raw Permalink Normal View History

2024-03-23 06:11:36 +00:00
#!/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