Need help to read command line arguments?

I am new to schell scripting . My objective is to write a ksh shell script that performs following tasks: -

  1. Script reads all command line arguments (arguments are file names) and checks if it contains charachters "abc" in it.
  2. If it contains "abc" it will execute a binary file xyz <command line arguments>
    Note: -
  3. arguments can be from 1 to n.
  4. arguments passed to this script will be used as arguments to execute binary xyz. (same arguments are used to execute shell script as well as binary)

$0 will be the name of the program you run
$1 will be the first argument
$2 will be the 2nd argument
.
.
$n will bet the nth argument

Unsurprisingly this is a common issue in scripting and where there is a common issue there is often a standard solution, in this case the use of the getopts command.
Take a look at IBM's well worked example of how getopts is used

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.