mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-22 04:27:58 +01:00
Adding script
This commit is contained in:
parent
3c5f2adc16
commit
dacb16c8f8
1 changed files with 24 additions and 0 deletions
24
ponysay
Executable file
24
ponysay
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/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 ${2}; exit;;
|
||||
\?) show_error "DERP"; exit;;
|
||||
esac
|
||||
done
|
Loading…
Reference in a new issue