title: bash script using sed to substitute twice
body: <p>file1 contains:</p>
  
  <pre><code>first=stan
  last=smith
  </code></pre>
  
  <p>I want to create file2 which contains</p>
  
  <pre><code>first=homer
  last=simpson
  </code></pre>
  
  <p>script.sh contains</p>
  
  <pre><code>#!/bin/bash
  sed s/stan/$1/ file1 &gt;tempfile
  sed s/smith/$2/ tempfile &gt;file2
  rm tempfile
  </code></pre>
  
  <p>script.sh homer simpson does what I want.<br>
  Is there a better way to do this in a bash script without creating and deleting tempfile?</p>