#!/bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/

# adds up the integers from 1 to $1

set -eu
set -o pipefail

if [ $# -ne 1 ]
then
	echo "usage: numsum NUM"
	exit 1
fi

NUM=$1

SUM=0
FOO=37

while test $NUM -ne 0
do
    SUM=$(expr $SUM + $NUM)
    NUM=$(( $NUM - 1))		#alternative way to do arithmetic
done

echo $SUM
# title $USER

