#!/bin/sh -u # $0 [args...] # Count and display each argument to this script (including $0). # # We use "printf" below because it doesn't expand backslash escapes. # (The "dash" shell version of echo does expand, and it can't be turned off.) # -Ian! D. Allen - idallen@idallen.ca - www.idallen.com export PATH=/bin:/usr/bin umask 022 # Display the name of this script. # printf "%s\n" "Argument 0 is [$0]" # Now display each of the command line arguments (if any). # count=0 for arg do count=$(( count+1 )) printf "%s\n" "Argument $count is [$arg]" done