diff options
| author | Zach DeCook <zachdecook@librem.one> | 2021-10-09 14:25:27 -0400 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2021-10-09 15:57:46 -0400 |
| commit | 6ccd1b82b2eb316fd95bbf9333cc5ed5809b509a (patch) | |
| tree | 9a7c62f972ff403341fb441fe890bf9d6d667a87 /swipeGuess.sh | |
| parent | 78b9951650925c50bc9e54030aa63b400ef7bcb1 (diff) | |
| download | swipeGuess-6ccd1b82b2eb316fd95bbf9333cc5ed5809b509a.tar.gz | |
scripts: try to make them pipe together better
it's important that the input program flushes the output
Diffstat (limited to 'swipeGuess.sh')
| -rwxr-xr-x | swipeGuess.sh | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/swipeGuess.sh b/swipeGuess.sh index 53fc4b4..f5f3225 100755 --- a/swipeGuess.sh +++ b/swipeGuess.sh @@ -3,15 +3,22 @@ swipeToQuery(){ swipe=$1 printf '^' - printf ${swipe:0:2} + printf "${swipe:0:2}" if test "${swipe:2}"; then printf "${swipe:2}" |grep -o . | xargs printf '\?%s' fi printf '$' } -wordlist="$2" +query(){ + swipe="$2" + wordlist="$1" -query=$(swipeToQuery $1) -echo "query: $query" > /dev/stderr -grep $query "$2" + query=$(swipeToQuery $swipe) + #echo "query: $query" > /dev/stderr + grep $query "$wordlist" +} + +while read -r line; do + test "$line" && query "$1" "$line" && printf '\n' +done |
