Unix Script Passing Argument to the script

From Ittichai Chammavanijakul's Wiki
Revision as of 10:44, 11 February 2012 by Ittichai (talk | contribs) (Created page with "<pre> #!/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 [ $...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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