mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-29 07:27:59 +01:00
28 lines
491 B
Text
28 lines
491 B
Text
|
#!/usr/bin/env bash
|
||
|
export PERL_UNICODE=S
|
||
|
|
||
|
ponydir=$PWD/ponies
|
||
|
|
||
|
function ponyf() {
|
||
|
if [[ -f ${ponydir}/${1}.cow ]] ; then
|
||
|
cowthink -f "${ponydir}/${1}.cow" $@
|
||
|
else
|
||
|
ponyr $@
|
||
|
fi
|
||
|
}
|
||
|
function ponyr() {
|
||
|
cowthink -f $(ls ${ponydir}/*.cow | sort -R | head -n1) $@
|
||
|
}
|
||
|
|
||
|
while getopts f:hv OPT
|
||
|
do
|
||
|
case ${OPT} in
|
||
|
v) echo "v0.01" ; exit;;
|
||
|
h) echo "helpherpderp" ; exit;;
|
||
|
f) ponyf $* ; exit;;
|
||
|
\?) echo "DERP"; exit;;
|
||
|
*) ponyr $* ; exit;;
|
||
|
esac
|
||
|
done
|
||
|
ponyr $*
|