title: How to pass Bash variables as Python arguments
body: <p>I'm trying to figure out if it is possible to pass values stored in a variable in Bash in as argument values in a python script.</p>
  
  <p>We have a python script that we use to create DNS records in BIND and I've been tasked with cleaning up our outdated DNS database. so far I have something like this in bash:</p>
  
  <pre><code>HOSTNAMES=$(&lt;/Users/test/test.txt)
  
  ZONE="zone name here"
  
  IP=$(&lt;/Users/test/iptest.txt)
  
  for host in $HOSTNAMES
  do
    python pytest.py --host $HOSTNAMES --zone $ZONE --ip $IP
  done
  </code></pre>
  
  <p>Unfortunately, I don't have a test environment where I can test this on before I run it on prod and I don't have any experience with Python or Bash scripting. I've mainly only done Powershell scripting, but was wondering if something like what I have above would work.</p>
  
  <p>I've looked around on the forums here but have not found anything that I could make sense of. This post seems to answer my question somewhat, but I'm still not completely sure how this works. <a href="https://stackoverflow.com/questions/7521061/how-to-pass-a-bash-variable-to-python">How to pass a Bash variable to Python?</a></p>