I recently wrote a script where I wanted to modify a file with sed before passing it as a parameter to another command:
$ some-command <(sed $'s\x01foo\x01bar\x01g' some-file)
This failed with the error:
sed: -e expression #1, char 8: unknown option to `s'
After some experimentation, I found that bash was duplicating the
\x01) character before calling sed:
$ cat -v <(echo $'\x01') ^A^A
This does not happen with ^B (or other) characters.
$ cat -v <(echo $'\x02') ^B
Where is this behaviour documented? Is it a result of some default setting where ^A is used for obscure functionality?
I'm seeing this in four different versions of bash that I have access to: 4.1.2, 4.2.25, 4.2.46 (linux) and 4.3.42 (cygwin)