I don't know whether this is an error coming from `help` or a bug of *bash*,
but it seems more logical to me that this is an error coming from *bash*.
Indeed, trying to use `printf` to assign a value to `$1` for example,
does return a error:
> bash$ printf -v 1 2
> -bash: `1': not a valid identifier
> bash$ echo $?
Re: printf does not return error on readonly assignment
On 7/6/17 12:41 AM, Arnaud Gaillard wrote:
> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
> According to the help page of the `printf` builtin, it
> should not return success when an error has occurred during the
>> Exit Status:
>> Returns success unless an invalid option is given or a write or assignment
>> error occurs.
> Assigning a value to a `readonly` variable returns an error code:
>> bash$ readonly a=2
>> bash$ a=3
>> -bash: a: readonly variable
>> bash$ echo $?
> However, assigning the value to a `readonly` variable via `printf -v`
> returns success:
Thanks for the report. This is a reasonable improvement to make.