#!/usr/bin/env bash # This function will create a random word pair with an underscore separator ex. turtle_ladder # It accepts one optional argument (an integer) (the number of words to return) set -euo pipefail random_words() { local num="${1:-2}" local -a arr local word # Validate input if ! [[ "$num" =~ ^[0-9]+$ ]] || [[ "$num" -lt 1 ]]; then echo "[ERROR] Argument must be a positive integer" >&2 return 1 fi # Check if dictionary file exists if [[ ! -f /usr/share/dict/words ]]; then echo "[ERROR] Dictionary file /usr/share/dict/words not found" >&2 return 1 fi for ((i=0; i