sh functions with "local variables"
    Govind N. Kamat 
    kamat at uceng.UC.EDU
       
    Sun Jun 18 21:17:02 AEST 1989
    
    
  
In article <1397 at marvin.Solbourne.COM> dce at Solbourne.com (David Elliott) writes:
+>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.
+>
+>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.
+>
+>Of course, arrays would be nice, too.
+>
+>Maybe it's time to implement sh++?
Well, ksh, which is already around allows you to define true local
variables, using the "typeset" command.  It also includes support for
arrays.
-- 
Govind N. Kamat 			College of Engineering
kamat at uceng.UC.EDU			University of Cincinnati
					Cincinnati, OH 45221, USA
    
    
More information about the Comp.unix.wizards
mailing list