diff --git a/tshell/enunciado.pdf b/tshell/enunciado.pdf index d6683ee4d4eb20bcb525db5736b6bceebb823885..d2e0f5290ed58eb2726f938192cfc17e1ae0ad8b 100644 Binary files a/tshell/enunciado.pdf and b/tshell/enunciado.pdf differ diff --git a/tshell/tshell_p1.sh b/tshell/tshell_p1.sh index c601ea16429b2c89c2056a1908d6f897ddcd0da3..54e3a166b750d79c4c12ee17a998a86b60d47815 100755 --- a/tshell/tshell_p1.sh +++ b/tshell/tshell_p1.sh @@ -16,6 +16,8 @@ if [ ! -d $FONTE ]; then exit 1 fi +FONTE=$(realpath $FONTE) + if [ ! -d $DESTINO ]; then mkdir $DESTINO fi diff --git a/tshell/tshell_p2.sh b/tshell/tshell_p2.sh index b5dd8f98840fd0917979923b6876ed681fe19b63..e7cdd2eddfbb0ce0b1a666e90126a9ed7f1d81ca 100755 --- a/tshell/tshell_p2.sh +++ b/tshell/tshell_p2.sh @@ -5,7 +5,7 @@ if [ $# -ne 2 ]; then exit 1 fi -testa_se_diretorio() { +testa_diretorio() { if [ ! -d $1 ]; then >&2 echo "Erro: $1 não é um diretório." exit 1 @@ -15,5 +15,17 @@ testa_se_diretorio() { DCSV=$1 DSIN=$2 -testa_se_diretorio $DCSV -testa_se_diretorio $DSIN +testa_diretorio $DCSV +DCSV=$(realpath $DCSV) + +testa_diretorio $DSIN +DSIN=$(realpath $DSIN) + +cd $DSIN +for FATOR in *; do + + CONT=$(grep -iwF -f $FATOR $DCSV/* | wc -l) + + echo "${FATOR%.*}:$CONT" +done +cd - > /dev/null