Fish-shell: disallow `read` without at least one var name

Created on 17 Jul 2017  ·  3Comments  ·  Source: fish-shell/fish-shell

This is a spinoff of this comment in issue #4206 by @0rax.

Commit d383e3b changed read to always define the variable even if no data was read. It assumed that at least one variable name was provided. But it is legal at present to invoke read with no variable names. Which doesn't make sense. The only reason that makes sense in bash and similar shells is they default to var name REPLY. Fish does not do that and therefore should not allow invoking read without at least one var name. Even if the user simply wants to discard a line of input they should have to specify a var name in which to store the line of text.

The question is whether we should change this for the 2.7.0 release -- the final release in the 2.x series. We absolutely should change this for the 3.0.0 release.

enhancement

Most helpful comment

I think make it behave as it did for 2.7, and make it an error for 3.0.

All 3 comments

I think make it behave as it did for 2.7, and make it an error for 3.0.

Can confirm that 71af1a9 restores the wanted behavior described in https://github.com/fish-shell/fish-shell/issues/4206.

Thanks for the quick fix !

Merged into the major branch for inclusion in our fish 3.0 release.

Was this page helpful?
0 / 5 - 0 ratings