title: Trying to append a string within a shell script using python
body: <p>I'm trying to change the value of &quot;dockerversion=&quot; in this bash script.</p>
  <pre><code># Docker Variables
  containerid=$(docker ps -qf &quot;name=vaultwarden&quot;)
  imageid=$(docker images -q vaultwarden/server)
  
  dockerversion=1
  ---------------
  
  # Stop/RM Image
  docker stop $containerid
  docker rm $containerid
  docker rmi $imageid
  </code></pre>
  <p>I'm using python and currently am at</p>
  <pre><code># Pull Portainer Version
  url = 'https://github.com/dani-garcia/vaultwarden/releases/latest'
  r = requests.get(url)
  version = r.url.split('/')[-1]
  
  # Pull Current Version
  with open('vaultwarden-update', 'r') as vaultwarden:
      fileversion = vaultwarden.readlines()
      vcurrentversion = re.sub(r'dockerversion=', '', fileversion[14])
  
  # Check who is higher
  if version &gt; vcurrentversion:
      with open('vaultwarden-update', '') as vaultwarden:
          for line in fileversion[14]:
              vaultwarden.write(re.sub(re.escape(vcurrentversion), version))
  </code></pre>
  <p>I basically want python to check the github releases, see if there's a change, compare that number to the bash script variable, update that within the bash-script and run the script.</p>
  <p>The # Check who is higher
  Won't work as I need to keep the entire other script file. Just mainly looking for ways to append/change a value through python. Dynamically.</p>
  <p>Any thoughts?</p>
  <p>(this is literally my first python script)</p>