title: Why does sh/bash set command line parameter values when trying to set environment variable?
body: <p>A question on basics : While tuning environment variables for a program launched from a script, I ended up with somewhat strange behaviour with sh (which seems to be actually linked to bash) : variable setting seems to mess up with command-line parameters.</p>
  
  <p>Could somebody explain why does this happen?</p>
  
  <p>A simple script:</p>
  
  <pre><code>#! /bin/sh
  
  # Messes with $1 ??
  set ANT_OPTS=-Xmx512M
  export ANT_OPTS
  
  # Works
  # export ANT_OPTS=-Xmx512M
  
  echo "0 = $0"
  echo "1 = $1"
  </code></pre>
  
  <p>When I run this with the upper alternative (set + export), the result is as following:</p>
  
  <pre><code>$ ./test.sh foo
  0 = ./test.sh
  1 = ANT_OPTS=-Xmx512M
  </code></pre>
  
  <p>But with lower alternative (export straight), the result is as I supposed:</p>
  
  <pre><code>$ ./test.sh foo
  0 = ./test.sh
  1 = foo
  </code></pre>
  
  <p>There is surely logical explanation, I just haven't figured it out yet. Somebody who does have idea?</p>
  
  <p>br, Touko</p>