mkbingo.sh (824B)
1 #!/bin/sh 2 3 set -eu 4 5 TMP="/tmp" 6 BINGO=${TMP}/bingo.txt 7 if [ -e ${BINGO} ] 8 then 9 rm ${BINGO} 10 else 11 touch ${BINGO} 12 fi 13 14 # there are too many things to choose from so we first make a selection 15 # of 15 randomised items from each categoy 16 for SRC_CAT in $(ls src/) 17 do 18 cat src/${SRC_CAT} | shuf | head -15 > ${TMP}/bingo-${SRC_CAT} 19 done 20 21 # we make a bingo cart from all these 22 for BNG_CAT in $(ls ${TMP}/bingo-*) 23 do 24 echo "#### "${BNG_CAT} 25 cat ${BNG_CAT} | shuf | head -5 >> ${TMP}/bingo.txt 26 done 27 28 # we fill the cart with these 29 cp bingo.tex.orig bingo.tex 30 i=1 31 cat ${BINGO} | while read CRAP 32 do 33 if [ ${#CRAP} -gt "55" ]; then 34 BINGOBOX="\\\\bingoboxSm{"$CRAP"};" 35 else 36 BINGOBOX="\\\\bingobox{"$CRAP"};" 37 fi 38 echo ${BINGOBOX} 39 sed -i "s@@TEXT${i}@@${BINGOBOX}g" bingo.tex 40 i=$((i+1)) 41 done 42 lualatex bingo.tex