aboutsummaryrefslogtreecommitdiff
path: root/ponysay
diff options
context:
space:
mode:
Diffstat (limited to 'ponysay')
-rwxr-xr-xponysay24
1 files changed, 11 insertions, 13 deletions
diff --git a/ponysay b/ponysay
index 2514001..83d76eb 100755
--- a/ponysay
+++ b/ponysay
@@ -1,26 +1,24 @@
#!/usr/bin/env bash
-PERL_UNICODE=S
-ponydir=/usr/share/ponies
-lponydir=/usr/local/share/ponies
+export PERL_UNICODE=S
+ponydir=$PWD/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" $@
+ cowsay -f "${ponydir}/${1}.cow" $@
else
- ponyr
+ ponyr
fi
}
function ponyr() {
- cowsay -f $(ls /usr/share/ponies/*.cow | sort -R | head -n1) $@
+ cowsay -f $(ls ${ponydir}/*.cow | sort -R | head -n1) $@
}
-while getopts f:h:v: OPT
+while getopts f:hv OPT
do
case ${OPT} in
- v) echo "v0.01" ;;
- h) echo "helpherpderp" ;;
- f) ponyf $* ;;
- *) ponyr $* ;;
+ v) echo "v0.01" ; exit;;
+ h) echo "helpherpderp" ; exit;;
+ f) ponyf ${2}; exit;;
+ \?) show_error "DERP"; exit;;
esac
done