Positional Parameter Settin in function
Brandon S. Allbery
allbery at ncoast.ORG
Sun Jun 11 03:46:15 AEST 1989
As quoted from <570024 at hpsemc.HP.COM> by gph at 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 at ncoast.org
uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery at hal.cwru.edu
Send comp.sources.misc submissions to comp-sources-misc@<backbone>
NCoast Public Access UN*X - (216) 781-6201, 300/1200/2400 baud, login: makeuser
More information about the Comp.unix.wizards
mailing list