From 929e6ae03765ab3d8b4f756abccb31cd33505f25 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 3 Sep 2016 20:48:41 -0400 Subject: [PATCH] We seem to have a nicely working fortune modlue now. --- modules/fortune/fortune.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/fortune/fortune.sh b/modules/fortune/fortune.sh index 0b1d131..82c88d2 100755 --- a/modules/fortune/fortune.sh +++ b/modules/fortune/fortune.sh @@ -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