title: Positional parameters in a script read with the source builtin in zsh
body: <p>I have noticed some weird behavior when sourcing another script within my shell script. The script that I am sourcing to setup the environment in my shell script takes an optional argument, e.g.</p>
  
  <pre><code>source setup.sh version1
  </code></pre>
  
  <p>However in my shell script I have also have command line argument variables. For example:</p>
  
  <pre><code>./myscript.sh TEST 1
  </code></pre>
  
  <p>Inside <code>myscript.sh</code>:</p>
  
  <pre><code>#!/bin/zsh
  source setup.sh
  echo ROOT version setup $ROOT_SYS
  ...more of the script
  </code></pre>
  
  <p>The problem that I have noticed with my script above is that the <code>$1</code> argument (<code>TEST</code> in this example) is used in the <code>source setup.sh</code> command. This causes the command to become </p>
  
  <pre><code>source setup.sh TEST
  </code></pre>
  
  <p>which of course fails as <code>setup.sh</code> does not have a version <code>TEST</code>.</p>
  
  <p>I solved this problem by editing my script to below.</p>
  
  <pre><code>#!/bin/zsh
  source setup.sh version1
  echo ROOT version setup $ROOT_SYS
  ...more of the script
  </code></pre>
  
  <p>The <code>source</code> command now does not pick up the <code>$1</code> argument.</p>
  
  <p>Why/How does the source command pick up the $1 argument when I am running my shell script?</p>