#!/usr/bin/env bash version=0.5 SYSTEMPONIES=/usr/share/ponies HOMEPONIES="${HOME}/.ponies" pony="*" wrap= cmd=cowsay [[ ${0} == *ponythink ]] && cmd=cowthink version() { echo "ponysay v$version" } usage() { version cat <&2; exit 1 ;; esac done shift $((OPTIND - 1)) if ! hash $cmd &>/dev/null; then cat >&2 <&2 "All the ponies are missing! Call the Princess!" exit 1 fi # Choose a random pony pony="${ponies[$RANDOM%${#ponies[@]}]}" fi if [[ -n "$*" ]]; then # Handle a message given via arguments say <<<"$*" else say fi