On Tue, 28 Aug 2012 14:44:40 EDT erik quanstrom <quans...@quanstro.net> wrote: > >=20 > > switch/case would make helluva difference over nested if/if not, if > > defaulted to fall-through. > > maybe you have an example? because i don't see that. if not works > fine, and can be nested. case without fallthrough is also generally > what i want. if not, i can make the common stuff a function. > > > variable scoping (better than subshel) would help writing larger > > scripts, but that's not necessarily an improvement ;-) something > > similar to LISP's `let' special form, for dynamic binding. > > there is variable scoping. you can write > > x=3D() y=3D() cmd > > cmd can be a function body or whatever. x and y are then private > to cmd. you can nest redefinitions. =20 > > x=3D1 y=3D2 {echo first $x $y; x=3Da y=3Db {echo second $x $y; x=3D=CE= > B1= > y=3D=CE=B2 {echo third $x $y}; echo ret second $x $y}; echo ret first $x= > $y} > first 1 2 > second a b > third =CE=B1 =CE=B2 > ret second a b > ret first 1 2
This is basically the same as let. Instead of let x=1 y=2 foo you say x=1 y=2 foo and this is lexical scoping. try lex=1 { echo $lex; } echo $lex vs { var=1; echo $var; } echo $var