We seem to have a nicely working fortune modlue now.

This commit is contained in:
Storm Dragon 2016-09-03 20:48:41 -04:00
parent cef3477e5c
commit 929e6ae037

View File

@ -1,14 +1,12 @@
[ -f functions.sh ] && source functions.sh
unset fortune
unset target
fortune="$(command -v fortune)"
if [ $# -ge 2 ]; then
target="$3"
fi
target="${3#fortune}"
if [ -z "$fortune" ]; then
msg "$2" "I do not have access to fortune."
else
msg "$2" "$($fortune -aesn 512 $target | tr '[:space:]' ' ' | sed -e 's/"/\"/g')"
fortuneText="$($fortune -a -e -s -n 512 $target || echo "No fortunes found.")"
fortuneText="$(echo "$fortuneText" | tr '[:space:]' ' ' | sed -e 's/"/\"/g')"
msg "$2" "$fortuneText"
fi