aboutsummaryrefslogtreecommitdiff
path: root/ponysay
blob: 25140010869d8f4b6b60f254c06b95e9404923f3 (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
#!/usr/bin/env bash
PERL_UNICODE=S
ponydir=/usr/share/ponies
lponydir=/usr/local/share/ponies
function ponyf() {
    if [[ -f ${ponydir}/${1}.cow ]] ; then
	cowsay -f "${ponydir}/${1}.cow" $@
    elif [[ -f ${lponydir}/${1}.cow ]] ; then
	cowsay -f "${lponydir}/${1}.cow" $@
    else
	ponyr
    fi
}
function ponyr() {
    cowsay -f $(ls /usr/share/ponies/*.cow | sort -R | head -n1) $@
}

while getopts f:h:v: OPT
do
    case ${OPT} in
	v)  echo "v0.01" ;;
	h)  echo "helpherpderp" ;;
	f)  ponyf $* ;;
	*)  ponyr $* ;;
    esac
done