Optional Parameters/arguments while executing a script.

Hello,

I have a shell script "Test.ksh" and I need to pass 8 parameters/arguments while executing the script

./Test.ksh 1 2 3 4 5 6 7 8

Out of these I want first 3 to be compulsory and rest 5 to be optional. Can you suggest the way to do this like and also how to pass these optional arguments like

Is it

./Test.ksh 1 2 3 4 7 8 #OR...
./Test.ksh 1 2 3 4 <space> <space>  7 8 or any other???

Hi.

if [ $# -lt 3 ]; then
  echo "not enough arguments..."
  ...
fi

You can have as many spaces as you like between arguments.

I would suggest looking at getopts.

Hello..

Thanks for the quicky..
Will "if [ $# -lt 3 ]" check for case when any 3 arguments are passed or the first 3.

Hi.

It will check that three arguments are passed.

It will not tell you if arguments 1, 2 and 3, or 1, 4 an 7 are passed, as you think of them.

I would suggest you use getopts.