Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 beta 3/9/83; site mot.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!bellcore!decvax!genrad!panda!talcott!harvard!seismo!ut-sally!oakhill!mot!al From: al@mot.UUCP (Al Filipski) Newsgroups: net.unix Subject: Re: "set" question for Bourne shell scripts Message-ID: <109@mot.UUCP> Date: Thu, 21-Feb-85 19:17:25 EST Article-I.D.: mot.109 Posted: Thu Feb 21 19:17:25 1985 Date-Received: Tue, 26-Feb-85 20:43:10 EST References: <661@turtlevax.UUCP> <70@timeb.UUCP>, <494@rlgvax.UUCP> Organization: Motorola Microsystems, Phoenix AZ Lines: 25 >> > 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.