#!/bin/bash # Function to check if the file contains SSA/ASS subtitles contains_ssa_ass() { local file="$1" if mkvmerge -i "$file" | grep -iq "SubStationAlpha"; then return 0 # Found SSA/ASS subtitles else return 1 # No SSA/ASS subtitles fi } # Function to check if the file has attachments check_pgs() { local file="$1" if mkvmerge -i "$file" | grep -iq "HDMV PGS"; then echo "$file" fi } export -f contains_ssa_ass export -f check_pgs # Find all .mkv files and process them find . -type f -name "*.mkv" | while read -r file; do if contains_ssa_ass "$file"; then check_pgs "$file" fi done