diff options
| author | Zach DeCook <zachdecook@librem.one> | 2021-10-10 01:01:00 -0400 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2021-10-10 01:01:00 -0400 |
| commit | c10522383a0c4908f0d65b2ff302b45640b5185a (patch) | |
| tree | d20b2508b5826d54c734db99156981a2e606b07a /swipeGuess.sh | |
| parent | 906af62ee4989cc19b9bc825311b3c1fcf183340 (diff) | |
| download | swipeGuess-c10522383a0c4908f0d65b2ff302b45640b5185a.tar.gz | |
guessSwipe: strip out single quotes to reduce tripping from thatt
Diffstat (limited to 'swipeGuess.sh')
| -rwxr-xr-x | swipeGuess.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/swipeGuess.sh b/swipeGuess.sh index 702be3e..fe52bbd 100755 --- a/swipeGuess.sh +++ b/swipeGuess.sh @@ -1,11 +1,11 @@ #!/bin/sh swipeToQuery(){ - swipe=$1 + swipe=$(echo "$1" | tr -d "'") printf '^' printf "${swipe:0:2}" if test "${swipe:2}"; then - printf "${swipe:2}" |grep -o . | xargs printf '\?%s' + printf "${swipe:2}" |grep -o . | xargs -I{} printf '\?%s' "{}" fi printf '$' } @@ -14,10 +14,10 @@ query(){ swipe="$2" wordlist="$1" - query=$(swipeToQuery $swipe) - #echo "query: $query" > /dev/stderr + query=$(swipeToQuery "$swipe") + echo "query: $query" > /dev/stderr # -m 1: just give first result - grep -m 1 $query "$wordlist" + grep -m 1 "$query" "$wordlist" } while read -r line; do |
