#!/bin/bash

# Iterate over all subdirectories
for dir in */; do
    # Check if it's a directory
    if [ -d "$dir" ]; then
        # Construct the file name based on the directory name
        file_name="./$dir/${dir%/}-mask.tsv"
        # Check if the file exists
        if [ -f "$file_name" ]; then
            # Check if the file is sorted
            if sort -c "$file_name"; then
                echo "File $file_name is sorted."
            else
                echo "File $file_name is not sorted."
            fi
        else
            echo "File $file_name does not exist."
        fi
    fi
done
