"set" question for Bourne shell scripts

Mike Leibensperger leiby at masscomp.UUCP
Fri Feb 15 05:16:14 AEST 1985


In article <661 at turtlevax.UUCP> ken at turtlevax.UUCP (Ken Turkowski) writes:
>The Bourne shell allows you to set the positional parameters with:
>	set a b c d e
>so that 
>	$1 yields a
>	$2 yields b
>	$3 yields c
>	$4 yields d
>	$5 yields e
>	$# yields 5
>regardless of the parameters given to the shell script on the command line.
>Now, my question is, how do you remove all parameters, i.e. set $# to 0?

The following works, tho it probably isn't the fastest:

	:
	while [ $# != 0 ]
	do
		echo my $# args are: $*
		shift
	done
--
Mike Leibensperger
Masscomp; 1 Technology Park; Westford, MA 01886
{decvax,harpo,tektronix}!masscomp!leiby



More information about the Comp.unix mailing list