Write Execute Bourne Shell Script Called Hw3 17 Requires List Numbers Command Line Argume Q23210305

. Write and execute a Bourne shell script calledhw3-17 that: Requires a list ofnumbers as command line arguments. The script will sum theodd arguments. The script should:

a. First display a count ofall arguments:

Example:    There are 5 arguments.

    

But if no arguments are listed when the script is run, theoutput should just be:

               No arguments to process.

                 and the script should exit.

B) Examine each the number that was given as command lineargument and determine if it is an odd number. If it is odd,display it and add its value to the odd numbersum.          (Hint:Try using a for-in loop)

C) After all the command line arguments have been examined,display the sum of the oddarguments.

For example, the command:
           $hw3-17 2 53 87 34 96 11

would produce the output:

     There are 6 input arguments.

Odd arguments:
     53

     87

     11

     Sum of the odd arguments is 151.

Note: If there were arguments, butnone of them wereodd arguments,
the sum displayed should be zero.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *