On 8/17/06, Axel Liljencrantz <[EMAIL PROTECTED]> wrote: > On 8/17/06, Martin Baehr <[EMAIL PROTECTED]> wrote: > > i'll play around with the function and see how far it gets me. > > is there a way to make it throw an error if the list is empty? > > I've never though about that, but it does make sense that command > substitutions would be able to stop the calling process from > executing. Not currently possible, but it should be. The obvious way > would be by returning a non-zero exit status. In other words the > command > > fish> echo This message is never printed (false) > > would never execute (unless you overload the false command).
I tried implementing this, and it seems like a nice idea in theory and a _really_ bad one in practice. grep and a lot of other commands fail when no matches are produced. Take a command like set -l foo (somecommand| grep somestring) You would expect foo to always have some value, but if there are no matches, then the command won't execute, and foo won't be initialized. This would be an awesome way to introduce really subtle bugs. Very evil. Not going to happen. Another option: Make the 'break' builtin break the calling command in a command substitution. Kind of wacky, and has the _huge_ downside that extrenal commands can't stop the caller of a command substitution from executing, but it would work. -- 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
