How to modify shortcode attributes with data from current post

For anyone who might stumble upon this, I’ve found a solution:

In my particular case, I’m using a single-[taxonomy].php template file, and was able to add the shortcode manually via the WordPress function do_shortcode() instead of modifying a shortcode within the post content.

Here’s how I wrote it:

<?php echo do_shortcode( '[mstw_schedule_table sched="'.$sports_slug.'" ]' ); ?>

And here’s how I got the $sports_slug to work for me. Previously in the file (outside the loop) :

// Get this post's sport taxonomy - https://wordpress.stackexchange.com/a/168862/127459
           $sports = get_the_terms($post->ID, 'sport');
           $sports_slug = '';
           if ($sports) { 

                foreach ($sports as $sport) {   
                    $sports_slug = $sport->slug;    
                }
           }

This code is slightly less complicated than what I used ( I needed to select only non-parent sport taxonomies ) but this simplified version may help someone else. These links helped me along the way:

Get custom category name from ID (Answer)

get_the_terms()