"set" question for Bourne shell scripts
Al Filipski
al at mot.UUCP
Fri Feb 22 10:17:25 AEST 1985
>> > The Bourne shell allows you to set the positional parameters with:
>> > set a b c d e
>> > Now, my question is, how do you remove all parameters, i.e. set $# to 0?
>>
>> Try 'unset *'. Should work.
>
>I did try it with the System III shell; it said:
>
> unset: not found
>
>"unset" must have been added in System V Release 1.0 or 2.0.
>
>
unset was added in V.2. You can remove named shell variables with it.
There may be a way to remove positional parameters with it, but
'unset *' doesn't work on our system (doesn't the shell expand the *
into filenames?). someone pointed out that the other solution posted
(shift $#) doesn't work under 4.1 when $# is already 0. It works fine
under V.2.
--------------------------------
Alan Filipski, UNIX group, Motorola Microsystems, Tempe, AZ U.S.A
{seismo | ihnp4 } ! ut-sally ! oakhill ! mot ! al
--------------------------------
May the peace of Landru be with you.
More information about the Comp.unix
mailing list