Looking to use CLI to automatically merge external subtitles to MKV if they are in the same folder

Hello! New to the forum and use MKVToolNix a lot but would like to automate my workflow a bit. Looking for a solution to one or both of these scenarios:

1.) I’d like to automatically merge subtitles to MKV files if they are in the same directory and have the same name. For example, merge:

  • Will.Trent.S01E01.mkv
  • Will.Trent.S01E01.srt

2.) Even better if the subtitle file itself doesn’t have the same name, but is in a folder with the same name as the MKV file.

  • /media/Will.Trent.S01E01.mkv
  • /media/Will.Trent.S01E01/01_eng.srt

Does anyone have a script that does any of these things? Thank you very much!