One of the things that I find ugly, about Posix shells, but that is doubtlessly useful, is the ability to assign a new value to a variable to only a single command in a simple way. If you want to run make with a strange value for $CC, but don't want to change the value in the shell proper, just use:
CC=icc make While I find this syntax illogical and limited, it is unquestionably often useful. The fish equivalent is the rather more verbose: begin; set -l CC icc; make; end It struck me that in interactive mode, every single commandline could be put in its own block scope. That way, you would get this behaviour: # The foo variable is local to the first commandline fish> set -l foo bar; echo $foo bar fish> echo $foo # No scope specified and the variable doesn't exist, so it is given global scope fish> set foo bar; echo $foo bar fish> echo $foo bar This means the above make example could be written as set -l CC icc; make which is comparable in length to the Posix version, and in my opinion much clearer since it reuses the regular assignment syntax in a straightforward way. It should also be noticed that this is analogous to the way that the '.' builtin also pushes a new scope, meaning that in a sourced file variables are global by default, but it is possible to create file-local variables by passing '-l' to set. I am quite happy with this addition to the syntax. The only drawback I can see with it is that it only works in interactive mode. You still have to do a full begin/end in non-interactive mode. The change to support this was all of a single line. The patch is in the darcs tree. Comments and criticism is welcome. -- Axel ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Fish-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fish-users
