Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!att!cbnewsh!ka@cbnewsh.ATT.COM From: ka@cbnewsh.ATT.COM (Kenneth Almquist) Newsgroups: comp.unix.wizards Subject: Re: sh functions with "local variables" Message-ID: <1634@cbnewsh.ATT.COM> Date: 21 Jun 89 18:35:00 GMT References: <1397@marvin.Solbourne.COM> <1206@uceng.UC.EDU> Sender: jgy@cbnewsh.ATT.COM Reply-To: ka@hulk.att.com Lines: 16 >+>Now, in modern versions of sh (post SVR2, I think), function parameters >+>are local to the function, but there's no way to have local variables >+>otherwise. Function arguments were made local in SVR3. >+>Now, if the function doesn't have any arguments, or if you can use >+>the arguments early and get rid of them, you can use "set" to put >+>values in $1-$9, which is one way to have local variables. Still, >+>real local variables would be great. I expect that POSIX (P1003.2) will include local variables, created using the "local" builtin command. Ash (which I recently posted to comp.sources.unix) supports local variables. Ksh also supports them, using the "typeset" builtin. Kenneth Almquist