This repository has been archived on 2023-05-01. You can view files and clone it, but cannot push or open issues or pull requests.
gus/examples/cgi/cgi-bin/cowsay

16 lines
329 B
Bash
Executable File

#!/usr/bin/env sh
set -euo pipefail
if [[ -z "$QUERY_STRING" ]]; then
printf "10 Enter a phrase.\r\n"
exit 0
fi
decodeURL() { printf "%b\n" "$(sed 's/+/ /g; s/%\([0-9a-fA-F][0-9a-fA-F]\)/\\x\1/g;')"; }
printf "20 text/gemini\r\n\`\`\`\n"
echo $QUERY_STRING | decodeURL | cowsay
echo "\`\`\`"
echo "\n=> $SCRIPT_NAME again"