#!/bin/sh -u # $0 number # This script shows the numbers from one to the number on the command line. # It does it twice. # # WARNING: Many of the comments in this file are "Instructor-Type" # comments and are *not* appropriate for real scripts. Do not put # "Instructor-Type" comments into the scripts that you submit for marking. # I put them in my example files because I am teaching you how to # write scripts; do not submit my teaching comments back to me again. # Read the week7.txt notes for more details on good comment style. # # -IAN! idallen@.ca export PATH=/bin:/usr/bin umask 022 # -ne is a numeric test # if test $# -ne 1 ; then # error messages go on standard error # error messages explain exactly what was found and what is wrong echo 1>&2 "Expecting one argument; found $# ($*)" exit 1 fi x=0 # this uses the "test" command explicitly while test "$x" -lt "$1" ; do let x=x+1 echo "The value of x is $x" done x=0 # this uses the "test" command implicitly (called '[') while [ "$x" -lt "$1" ]; do let x=x+1 echo "The value of x is $x" done