title: Change value of XML attribute with sed
body: <p>I need to add a build number to the <code>version</code> attribute value of my xml file:</p>
  
  <pre><code>&lt;widget id="com.test.enterprise.operationsnew" version="2.4.2.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"&gt;
  </code></pre>
  
  <p>In my bash script I've tried:</p>
  
  <pre><code>BUILD_NUMBER=1
  VERSION="$(xmllint \
    -xpath 'string(//*[local-name()="widget"]/@version)' config.xml | \
    cut -f1-3 -d.)"
  CFBundleVersion="${VERSION}.${BUILD_NUMBER}"
  
  sed -i '' \
    -e 's#version="[0-9].[0-9].[0-9].[0-9]"#version="${CFBundleVersion}"#g' \
    config.xml
  </code></pre>
  
  <p>The <code>CFBundleVersion</code> variable does get inserted, but not resolved: </p>
  
  <pre><code>&lt;widget id="com.test.enterprise.operationsnew" version="${CFBundleVersion}" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"&gt;
  </code></pre>
  
  <p>How can I do this properly with sed?</p>