Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!cwjcc!hal!ncoast!allbery From: allbery@ncoast.ORG (Brandon S. Allbery) Newsgroups: comp.unix.wizards Subject: Re: Positional Parameter Settin in function Message-ID: <13740@ncoast.ORG> Date: 10 Jun 89 17:46:15 GMT References: <570024@hpsemc.HP.COM> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery) Followup-To: comp.unix.wizards Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 22 As quoted from <570024@hpsemc.HP.COM> by gph@hpsemc.HP.COM (Paul Houtz): +--------------- | In my ksh, the "set" command doesn't seem to work within a function: | Is this a bug in ksh? Is it a feature? Is there some explanation of this | feature? +--------------- Feature. Positional parameters are local to a function; as "set" sets positional parameters, its effect is lost when the function exits. Under (System V) /bin/sh, positionals are global: "set" works the way you expect, but calling a function with arguments destroys the shell's global parameters -- which has caused me considerable annoyance at times. I prefer the ksh implementation. ++Brandon -- Brandon S. Allbery, moderator of comp.sources.misc allbery@ncoast.org uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu Send comp.sources.misc submissions to comp-sources-misc@ NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser