makegame.sh (1085B)
1 #!/bin/bash 2 3 # htmlredirect from https://a3nm.net/git/mybin/tree/htmlredirect 4 5 set -x 6 7 touch enigmes2_with_solution 8 truncate -s 0 enigmes2_with_solution # make file empty 9 cd game 10 CODE=$(pwgen 16 1) 11 NUM=1 12 cp ../main.css . 13 htmlredirect "$CODE" > index.html 14 while read l 15 do 16 SUFFIX=$(echo "$l" | awk '{ print $2 }') 17 GENDER=$(echo "$l" | awk '{ print $1 }') 18 echo -n "$SUFFIX $GENDER" >> ../enigmes2_with_solution 19 GCODE=$(echo "$GENDER" | cut -b 1) 20 mkdir -p $CODE 21 cd $CODE 22 python -m markdown -x markdown.extensions.toc ../../template.md | 23 cat ../../head - ../../foot | 24 sed "s/NUM/$NUM/;s/GENDER/$GENDER/;s/SUFFIX/$SUFFIX/g" \ 25 > index.html 26 CODE=$(pwgen 16 1) 27 NUM=$(($NUM+1)) 28 grep "$SUFFIX\s[fm]" ../../noms_all | grep "\s$GCODE\s" | cut -f 1 | sort | 29 while read ll 30 do 31 echo -n " $ll" >> ../../enigmes2_with_solution 32 htmlredirect "../$CODE" > ${ll}.html 33 done 34 cd .. 35 echo >> ../enigmes2_with_solution 36 done 37 mkdir -p $CODE 38 cd $CODE 39 python -m markdown -x markdown.extensions.toc ../../finish.md | 40 cat ../../head - ../../foot > index.html 41 cd .. 42