Positional Parameter Settin in function
L. Mark Larsen
lml at cbnews.ATT.COM
Wed Jun 7 08:05:50 AEST 1989
# In article <570024 at hpsemc.HP.COM> gph at hpsemc.HP.COM (Paul Houtz) writes:
#
# In my ksh, the "set" command doesn't seem to work within a function:
#
It works in a function - it just sets the positional parameters for
*that* function - not the current shell.
# As a shell command I do the following:
(example deleted)
#
# Is this a bug in ksh? Is it a feature? Is there some explanation of this
# feature?
This is not a bug but the way functions are supposed to work. To modify
the positional parameters of the current shell by executing some shell
script, use ". filename [args]" (reads the file and executes it in the
current environment). Note that Bourne shell does not allow arguments
and that in ksh, passing arguments in this manner is the same as setting
the positional parameters of the current shell.
cheers,
-lml
More information about the Comp.unix.wizards
mailing list