Unix Script Passing Argument to the script

From Ittichai Chammavanijakul's Wiki
Jump to navigation Jump to search
#!/bin/ksh

# These are the default variables. Note that $0 is the script name.
NUMARG=$#
ARGALL=$*
PGMNAM=$0

# Each argument is $1, $2, and so on.
ARG1=$1
ARG1=$2

if [ ${NUMARG} -lt 1 ]
then
  echo "$0 `date`: One argument is required."
  exit 99
fi