We seem to have a nicely working fortune modlue now.
This commit is contained in:
parent
cef3477e5c
commit
929e6ae037
@ -1,14 +1,12 @@
|
|||||||
[ -f functions.sh ] && source functions.sh
|
[ -f functions.sh ] && source functions.sh
|
||||||
|
|
||||||
unset fortune
|
|
||||||
unset target
|
|
||||||
fortune="$(command -v fortune)"
|
fortune="$(command -v fortune)"
|
||||||
if [ $# -ge 2 ]; then
|
target="${3#fortune}"
|
||||||
target="$3"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$fortune" ]; then
|
if [ -z "$fortune" ]; then
|
||||||
msg "$2" "I do not have access to fortune."
|
msg "$2" "I do not have access to fortune."
|
||||||
else
|
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
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user