Skip to content

Commit

Permalink
Simplify nlp verify
Browse files Browse the repository at this point in the history
  • Loading branch information
vagos committed Oct 20, 2024
1 parent a564238 commit 660474e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions nlp/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 660474e

Please sign in to comment.