Need Help with the argument passing Through Command line

$$$$$

Hi,

This can be done using AWK command by passing the $2 in the script. Please refer the below link for awk tutorial.

[Awk - A Tutorial and Introduction - by Bruce Barnett](AWK tutorial)

Cheers,
Shazin

My approach:

./XmlTool.sh [platform] '[full path]'
if [ $# -ne 2 ]
then
  usage
  exit 1
fi
FILE_WINDOWS=$( $LS "$2" | $GREP "fix_com" )
case "$1" in
  "sun") 
    [whatever] ;;
  "rhat") 
    [whatever] ;;
  "windows")
    [whatever] ;;
esac

$$$$$

You are not being very logic, since you accepted the plateform as an argument then why not for the path as Dr. House suggested?
Else
You are to rewrite your script and use and set getopt with while and tuttiquanti...

A couple example command line processors of different methods...

The method I prefer... I believe it's originator is cfajohnson ... Thanks!
I have formated mine vertically though.

args=
while [ $# -ge 1 ]
do
  case $1 in
    -h | --help) echo help; exit ;;
    -v | --version) echo Version 0.01; exit ;;
    -V | --Verbose ) versbose=1 ;;
    -o ) filename=$2; shift ;;
    -o*) filename=${1#-o} ;;
    --output=) filename=${1#*=} ;;
    -s) searchphrase=$2; shift ;;
    -s*) ${1#-s} ;;
    --search=) searchphrase=${1#*=} ;;
    -f) format=$2; shift ;;
    -f*) format=${1#-f} ;;
    --format=) format${1#*=} ;;
    -*) echo invalid option >&2; exit 1 ;;
    *) args="$args
$1"
       ;;
  esac
  shift
done
oldIFS=$IFS
IFS='
'
set -f
set -- $args
IFS=$oldIFS
set +f

Don't know who posted this... Personally I do not like the getop method or the use of basename... However I believe it is the most common method.

usage() {
	echo `basename $0`: ERROR: $* 1>&2
	echo usage: `basename $0` '[-[abc]] [-o file]' '[file ...]' 1>&2
	exit 1
}

set -- `getopt "abco:" "$@"` || usage

a= b= c= o= 
while :
do
        case "$1" in
        -a) a=1;;
        -b) b=1;;
        -c) c=1;;
        -o) shift; o="$1";;
        --) break;;
        esac
        shift
done
shift # get rid of --
# rest of script...

-Enjoy
fh : )_~