Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: err_return inside function who's return value is checked



On Sun, Dec 30, 2012 at 2:35 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> This obviously is a case where err_return might be permitted to behave
> differently without causing too much consternation, but that's not how
> it has been defined.

Can this be arranged? It would enable idioms like the following to be used:

function get_major_version {
  setopt err_return
  [[ $(program -V) =~ "version ([[:digit:]]+)\." ]]
  REPLY=$match[1]
}

which I think is quite nice



Messages sorted by: Reverse Date, Date, Thread, Author