diff options
-rwxr-xr-x | ponysay | 24 |
1 files changed, 11 insertions, 13 deletions
@@ -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 |