Difference between revisions of "Unix Script Passing Argument to the script"

From Ittichai Chammavanijakul's Wiki
Jump to navigation Jump to search
(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 [ $...")
 
 
Line 18: Line 18:
  
 
</pre>
 
</pre>
 +
 +
[[Category: Unix Scripts]]

Latest revision as of 10:45, 11 February 2012

#!/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