Looking for a way to de-reference a bash var wrapped in a python command call
<p>I'm trying to find a way to de-reference goldenClusterID to use it in an AWS CLI command to terminate my cluster.  This program is to compensate for dynamic Job-Flow Numbers generated each day so normal Data Pipeline shutdown via schedule is applicable.  I can os.system("less goldenClusterID") all day and it gives me the right answer.  However, it won't give up the goodies with a straight de-ref.  Suggestions?</p>

<pre><code>from __future__ import print_function

import json
import urllib
import boto3
import commands
import os
import re
import datetime
import awscli

foundCluster = ""
rawClusterNum = ""
mainClusterNum = ""
goldenClusterID = ""

#   Next, we populate the list file with clusters currently active
os.system("aws emr list-clusters --active &gt;&gt; foundCluster")
#   We search for a specific Cluster Name
os.system("fgrep 'AnAWSEMRCluster' foundCluster")
os.system("grep -B 1 DrMikesEMRCluster foundCluster &gt;&gt; rawClusterNum")
#   Look for the specific Cluster ID in context with it's Cluster Name
os.system("fgrep 'j-' rawClusterNum &gt;&gt; mainClusterNum")
#   Regex the Cluster ID from the line
os.system("grep -o '\j-[0-9a-zA-Z]*' mainClusterNum &gt;&gt; goldenClusterID")
#   Read the Cluster ID from the file and run AWS Terminate on it
os.system("aws emr describe-cluster --cluster-id %s" % goldenClusterID")
os.system("aws emr terminate-clusters --cluster-ids goldenClusterID")
os.system("rm *")
</code></pre>