]> git.ralfj.de Git - multypo.git/blobdiff - play.sh
allow passing words file as argument
[multypo.git] / play.sh
diff --git a/play.sh b/play.sh
index 5ee9b2dfc032701d627b179b4ffb62de2d40b15e..d9367efd93cea93a2596be5cd12c576290a28600 100755 (executable)
--- a/play.sh
+++ b/play.sh
@@ -1,8 +1,13 @@
-#!/bin/sh
+#!/bin/bash
 
 # you should probably download a txt dictionary of your favourite language and use that as a words.txt
 
 WORDSTOPLAY=10
+WORDSFILE="$1"
+if [[ -z "$WORDSFILE" ]]; then
+       WORDSFILE="words.txt"
+fi
 
-sort -R words.txt | fgrep -v \" | head -n $WORDSTOPLAY | ./game
+export LC_ALL=C # dont do unicode stuff in egrep
+sort -R "$WORDSFILE" | sed 's/\/.*//' | egrep '^[A-Za-z]{5,}$' | head -n $WORDSTOPLAY | tr [:upper:] [:lower:]  | qt/multypo