On 3/12/15 2:13 PM, Peng Yu wrote:
>>> The -i option obviously works with set. But it is missing in the man
>>> page. Should this be added?
>>
>> No. It's really only there for completeness, so things like `set $-'
>> work as expected without error.
>
> But if something is in the implementation,
On Friday, March 13, 2015, Chet Ramey wrote:
> On 3/12/15 2:13 PM, Peng Yu wrote:
> >>> The -i option obviously works with set. But it is missing in the man
> >>> page. Should this be added?
> >>
> >> No. It's really only there for completeness, so things like `set $-'
> >> work as expected with
This works as I would expect:
$ arr=(a b c); IFS=+; echo "${arr[*]/a/x}"
x+b+c
But for some reason, this ignores IFS:
$ arr=(a b c); IFS=+; arr=${arr[*]/a/x}; echo "$arr"
x b c
Here is the behaviour of other shells that allow that kind of syntax:
input: arr=(a b c); IFS=+; echo "${arr[*
> You can avoid these surprises by making -i just as other options, i.e.,
> working within the shell not just when a shell is started. [..]
I don't think it's good to have set +/-i available after initialization. It's
more complex to handle, and with little (or null?) gain. If you're using
set -i i