#!/bin/bash MESSAGE_FILE="/messages.yaml" OUTPUT_FILE=${OUTPUT_FILE:-"message.txt"} NUM_MESSAGES=$(yq eval '.messages | length' "$MESSAGE_FILE") RANDOM_INDEX=$(( RANDOM % NUM_MESSAGES )) MESSAGE=$(yq eval ".messages[$RANDOM_INDEX]" "$MESSAGE_FILE") echo "$MESSAGE" > "$OUTPUT_FILE" echo "Selected message written to $OUTPUT_FILE"