title: Basename command in shell script
body: <p>I am trying to run the following as part of a application start script:</p>
  
  <pre><code>for file in $TEMPLATE_FOLDER/*
  do
      filename='basename $file'
      echo "Processing $filename"
  
      if [ -f "$CONF_FOLDER/$filename" ]
      then
          echo "Using existing $filename"
      else
          echo "Creating $filename from template $file"
          cp $file $CONF_FOLDER
      fi
  done
  </code></pre>
  
  <p>But the output is:</p>
  
  <pre><code>Processing basename $file
  Creating basename $file from template ../conf/templates/conf-TEST/log4j.xml
  </code></pre>
  
  <p>The basename command is not evaluated and is just printed out.</p>
  
  <p>When i run the command from the prompt it works fine.</p>
  
  <p>Bash version:</p>
  
  <pre><code>bash -version
  GNU bash, version 3.00.16(1)-release (sparc-sun-solaris2.10)
  Copyright (C) 2004 Free Software Foundation, Inc.
  </code></pre>
  
  <p>Can anyone see what i am doing wrong?</p>
  
  <p>Thanks!</p>