Random Quote
Displays a random quote from a text file centered in the terminal. Great for adding a spark of inspiration to your terminal sessions.
#!/bin/bash
QUOTE_FILE="$HOME/.config/quote/quotes.txt"
if [[ ! -f "$QUOTE_FILE" ]]; then
echo "No quotes file found at $QUOTE_FILE"
exit 1
fi
quote=$(shuf -n 1 "$QUOTE_FILE")
cols=$(tput cols)
padding=$(( (cols - ${#quote}) / 2 ))
clear
for _ in {1..5}; do echo; done
printf "%*s\n" $((padding + ${#quote})) "$quote"
for _ in {1..5}; do echo; done
scroll horizontally if code overflows