24 lines
753 B
Text
24 lines
753 B
Text
##!/usr/bin/env bash
|
|
|
|
case "$1" in
|
|
"dad")
|
|
joke=$(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='</div>' '/<div class='\''f'\''>/{gsub(/.*<div class='\''f'\''>/,""); print "- " $0}'
|
|
;;
|
|
esac
|