title: Calculate sum of command line arguments and display the result
body: <p>Write a bash script that adds its command line arguments and display the result. Assume command line arguments are all integers apart from the argument itself.</p>
  
  <p>So for example:</p>
  
  <pre><code>% addprogram 2 5 7
  The total is 14
  </code></pre>
  
  <p>I've tried all I can and can't seem to find anything on the net, please keep the answer really simple.</p>
  
  <p>I've tried stuff like:</p>
  
  <pre><code>#!/bin/bash
  
  total += $@
  </code></pre>
  
  <p>But I don't think that operator exists in bash.</p>
  
  <p>My algorithm would be something like this:</p>
  
  <ol>
  <li>For argument passed from the command line,</li>
  <li>Add the first argument to the total,</li>
  <li>move onto the next argument and add that to the total,</li>
  <li>repeat as long as there are arguments</li>
  <li>output total</li>
  </ol>