2016-09-03 19:38:05 -04:00
|
|
|
[ -f functions.sh ] && source functions.sh
|
2016-09-03 18:57:19 -04:00
|
|
|
|
2016-09-03 19:38:05 -04:00
|
|
|
fortune="$(command -v fortune)"
|
2016-09-03 20:48:41 -04:00
|
|
|
target="${3#fortune}"
|
2016-09-03 18:57:19 -04:00
|
|
|
|
2016-09-03 19:38:05 -04:00
|
|
|
if [ -z "$fortune" ]; then
|
|
|
|
msg "$2" "I do not have access to fortune."
|
|
|
|
else
|
2016-09-03 20:48:41 -04:00
|
|
|
fortuneText="$($fortune -a -e -s -n 512 $target || echo "No fortunes found.")"
|
|
|
|
fortuneText="$(echo "$fortuneText" | tr '[:space:]' ' ' | sed -e 's/"/\"/g')"
|
|
|
|
msg "$2" "$fortuneText"
|
2016-09-03 19:38:05 -04:00
|
|
|
fi
|