Arguably it's a bug that 'help read' doesn't mention the effect of backslashes, other than what can be extrapolated from the description of -r. It only says "The line is split into fields _as with word splitting_", but word splitting doesn't recognize backslashes as special. It should not be necessary to read the description of all options to infer the behaviour of a command as used without them.
The online reference is clearer on this: https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html#index-read On Tue, Dec 22, 2020 at 4:05 PM <k...@plushkava.net> wrote: > On 22/12/2020 08:18, ffvh gfff wrote: > > Machine: x86_64 > > OS: linux-gnu > > Compiler: gcc > > Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat > > -Werror=format-security -Wall > > uname output: Linux kali 5.7.0-kali1-amd64 #1 SMP Debian 5.7.6-1kali2 > > (2020-07-01) x86_64 GNU/Linux > > Machine Type: x86_64-pc-linux-gnu > > > > Bash Version: 5.1 > > Patch Level: 0 > > Release Status: release > > > > command line: > > cat poc.txt | while read i; do echo $i;do > In fact, the read builtin can read backslashes. It's just that you > didn't escape them. Use the -r option. > > $ help read | grep -- -r > -r do not allow backslashes to escape any characters > > $ echo '\' | { read i; echo "$i"; } > > $ echo '\' | { read -r i; echo "$i"; } > \ > > -- > Kerin Millar > >