CORRECTION.....
Number of arguments passed is 8
should have read
        Number of arguments passed is 5

Sorry 'bout that. I tried a few tests of the script with various args and copy-pasted the wrong ones for my post example.
I better go back to bed...
-James



On Mar 11, 2004, at 3:35 AM, James Cass wrote:


Kevin -

The environment variable you're looking for is:  $#
For example, if I had this little shell script called "args.sh"

        #!/bin/sh
        echo Number of arguments passed is $#
        for arg in "$@"
        do
          echo $arg
        done

and passed it this:
        args.sh 1 2 3 4 5

it would return this:

        Number of arguments passed is 8
        1
        2
        3
        4
        5

Hope this helps....James


On Mar 11, 2004, at 2:14 AM, Kevin wrote:




I am unable to locate a construct that would provide the number of parameters that have been passed via the command line. I am aware of $0 ... $n but how does one know how many there are a how would I loop through them?

Kevin


-==-=-=-=-=-=-==-=-=-=-=-=-=-=-==-=-=-=-=-=- Disclaimer:

Any resemblance between the above views and those of my
employer, my terminal, or the view out my window are purely
coincidental.
Any resemblance between the above and my own views is non-deterministic.


The question of the existence of views in the absence of anyone to hold
them
is left as an exercise for the reader. The question of the existence of
the reader
is left as an exercise for the second god coefficient.
(A discussion of non-orthogonal, non-integral polytheism is beyond the
scope of this article.)




_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to