#!/bin/sh -x set -e if ! command -v curl >/dev/null 2>&1; then printf "This script depends on curl.\n" exit 64 # sysexits(3) EX_USAGE fi ZELDA="https://archive.org/download/cirno_actually_plays_zelda_in_terminal/zelda.wav" CURL="curl -Ls" if command -v aplay >/dev/null 2>&1; # ALSA then $CURL "$ZELDA" | aplay elif ls /dev/dsp >/dev/null 2>&1; # OSS then curl -L "$ZELDA" >/dev/dsp elif command -v audioplay >/dev/null 2>&1; # NetBSD audio(4) then $CURL "$ZELDA" | audioplay -f -e ulinear -P 16 -s 48000 else printf "Unknown sound device. Sorry!\n" exit 70 # sysexits(3) EX_SOFTWARE fi exit 0