##!/usr/bin/env bash case "$1" in "dad") joke=$(/usr/bin/curl -sH "Accept: text/plain" 'https://icanhazdadjoke.com/') echo "Daily Dad Joke: $joke" ;; "bofh") file="$HOME/.local/share/bofh" lines=$(nl "$file" | tail -n 1 | awk '{print $1}') echo -n "Daily BOFH Excuse: " awk 'NR=='$((1 + RANDOM % lines ))'{print;exit}' "$file" ;; "hq") file="$HOME/.local/share/hackerquotes/$2" lines=$(nl "$file" | tail -n 1 | awk '{print $1}') echo -n "Daily Hackerquote: " awk 'NR=='$((1 + RANDOM % $lines ))'{print;exit}' "$file" ;; "fact") echo "Daily Facts:" curl -s 'https://randomfactgenerator.net/' | awk -v RS='' '/
/{gsub(/.*
/,""); print "- " $0}' ;; esac