From 660474e95bbb4aaf2bb8ee0a113020eed62fa56d Mon Sep 17 00:00:00 2001 From: Evangelos Lamprou Date: Sun, 20 Oct 2024 17:05:51 -0400 Subject: [PATCH] Simplify nlp verify --- nlp/verify.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/nlp/verify.sh b/nlp/verify.sh index 32655634..f4f45d73 100755 --- a/nlp/verify.sh +++ b/nlp/verify.sh @@ -15,10 +15,10 @@ fi if [[ "$@" == *"--generate"* ]]; then # Directory to iterate over - directory="outputs/bash" + directory="outputs" # Loop through all .out files in the directory - find "$directory" -mindepth 2 -type f -name '*.out' | while read -r file; + find "$directory" -type f -name '*.out' | while read -r file; do # Extract the filename and dirname filename=$(basename "$file" .out) @@ -34,25 +34,27 @@ if [[ "$@" == *"--generate"* ]]; then echo "$hash" > "$hash_folder/$dirname/$filename.hash" # Print the filename and hash - echo "File: $hash_folder/$dirname/$filename.hash | SHA-256 Hash: $hash" + echo "$hash_folder/$dirname/$filename.hash" "$hash" done + + exit 0 fi # Loop through all directories in the parent directory for folder in "outputs"/* do # Loop through all .out files in the current directory - find "$folder" -mindepth 2 -type f -name '*.out' | while read -r file; + find "$folder" -type f -name '*.out' | while read -r file; do # Extract the filename and dirname filename=$(basename "$file" .out) dirname=$(basename "$(dirname "$file")") # is the script_name # Generate SHA-256 hash - shasum -a 256 "$file" | awk '{ print $1 }' > "$folder/$dirname/$filename.hash" + shasum -a 256 "$file" | awk '{ print $1 }' > "$file.hash" # Compare the hash with the hash in the hashes directory - diff "$hash_folder/$dirname/$filename.hash" "$folder/$dirname/$filename.hash" > /dev/null + diff "$hash_folder/$dirname/$filename.hash" "$file.hash" > /dev/null match="$?" # Print the filename and match