#!/opt/bin/bash
cd /opt/fortunes
size=200
while [ $size -gt 130 ];do
file=$(ls /opt/fortunes/| /opt/bin/shuf -n 1)
Q=$(awk -v RS='%' '
BEGIN { srand(); }
rand() < 1.0/NR { s=$0; }
END { print s; }
' $file| /opt/bin/sed ':a;N;$!ba;s/\n/ /g;s/\t\t*/ /g' | tr -s ' ')
size=$(echo $Q | wc -c)
done
echo "QOTD: $Q"