Re: Unsuccessful assignment of a readonly variable does not return 1

2016-12-12 Thread Chet Ramey
On 12/12/16 5:11 AM, Laur Aliste wrote: > > Hi, > is it accepted behavior for a failing assignment of a readonly variable to > return successfully? The readonly builtin did not fail; the variable `j' was set readonly, and, as a side effect, the shell assigned it the null string. The assignment t

Unsuccessful assignment of a readonly variable does not return 1

2016-12-12 Thread Laur Aliste
Hi, is it accepted behavior for a failing assignment of a readonly variable to return successfully? See following code: fail() { return 1 } o() { local i j i="$(fail)" || echo "i init failed" readonly j="$(fail)" || echo "j init failed" # this echo is not executed } Expected

Re: Unsuccessful assignment of a readonly variable does not return 1

2016-12-12 Thread Laur Aliste
Forgot to add: GNU bash, version *4.4.5(1)-release* (x86_64-pc-linux-gnu), running on Debian testing. On Mon, Dec 12, 2016 at 11:11 AM, Laur Aliste wrote: > > Hi, > is it accepted behavior for a failing assignment of a readonly variable to > return successfully? > > See following code: > > fail(