title: Help with aliases in shell scripts
body: <p>I have the following code, which is intended to run a java program on some input, and test that input against a results file for verification.</p>
  
  <pre><code>#!/bin/bash
  java Program ../tests/test"$@".tst &gt; test"$@".asm
  spim -f test"$@".asm &gt; temp
  diff temp ../results/test"$@".out
  </code></pre>
  
  <p>The gist of the above code is to:</p>
  
  <ol>
  <li>Run Program on a test file in another directory, and pipe the output into an assembly file.</li>
  <li>Run a MIPS processor on that program's output, piping that into a file called temp.</li>
  <li>Run diff on the output I generated and some expected output.</li>
  </ol>
  
  <p>I made this shell script to help me automate checking of my homework assignment for class. I didn't feel like manually checking things anymore. </p>
  
  <p>I must be doing something wrong, as although this program works with one argument, it fails with more than one. The output I get if I use the $@ is:</p>
  
  <pre><code>./test.sh: line 2: test"$@".asm: ambiguous redirect
  Cannot open file: `test0'
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Ah, I figured it out. This code fixed the problem:</p>
  
  <pre><code>#!/bin/bash
  for arg in $@
  do
  java Parser ../tests/test"$arg".tst &gt; test"$arg".asm
  spim -f test"$arg".asm &gt; temp
  diff temp ../results/test"$arg".out
  done
  </code></pre>
  
  <p>It turns out that bash must have interpreted a different cmd arg for each time I was invoking $@.</p>
  
  <pre><code>enter code here
  </code></pre>