Let the file foo.txt containfoo\\ bar baz xxWhy does the following correctly change foo\\ bar to someotherstuff in foo.txt?sed -i 's/foo\\\\ bar/someotherstuff/gI' foo.txtwhile this does not?a=(foo\\\\ bar) b=(someotherstuff) for ((i=0;i<${#a[@]};++i)); do     sed -i s/${a[i]}/${b[i]}/gI foo.txt doneThey are supposed to be the same.
Different behavior of sed with respect to an array and a string in the presence of backslashes
bash;sed;quoting