From b4c8924ac627d614097b05dfbf403ca0b649b2cc Mon Sep 17 00:00:00 2001 From: fanta Date: Thu, 10 Feb 2022 15:32:14 +0100 Subject: [PATCH] =?UTF-8?q?arreglos=20y=20funci=C3=B3n=20showerrors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wordle.sh | 18 +++++++++++++++--- palabras.txt => words-es.txt | 0 2 files changed, 15 insertions(+), 3 deletions(-) rename palabras.txt => words-es.txt (100%) diff --git a/wordle.sh b/wordle.sh index 9df11c1..2d4c717 100755 --- a/wordle.sh +++ b/wordle.sh @@ -1,7 +1,19 @@ #!/bin/bash -# grep -iEw "n..io" palabras.txt +# fanta +# Helper script to find words in the spanish worlde version +wordList="words-es.txt" + +function showError(){ + echo "[Error] $1" +} + if [ -z "$1" ]; then - echo "Mete el parametro. Ejemplo: wordle.sh n..io . Siendo los puntos lo que desconoces." + showError "Example: wordle.sh n..io (The dots are the unknown characters)" else - grep -iEw "$1" palabras.txt + if [ $(echo -n "$1" | wc -m) -le 5 ]; then + grep -iEw "$1" $wordList + # la salida tendria que ser de palabras solamente con 5 caracteres + else + showError "Too many characters my friend. They must be 5" + fi fi diff --git a/palabras.txt b/words-es.txt similarity index 100% rename from palabras.txt rename to words-es.txt