aboutsummaryrefslogtreecommitdiff
path: root/ponysay
blob: e9e6141a8a0b95d3ac35714254f83fc5f472df26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash
export PERL_UNICODE=S

ponydir=$PWD/ponies

function ponyf() {
    if [[ -f ${ponydir}/${1}.cow ]] ; then
        cowsay -f "${ponydir}/${1}.cow" $@
    else
        ponyr $@
    fi
}
function ponyr() {
    cowsay -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 $*