sh: Backslash-newline should not affect field splitting in read builtin.

This was originally broken in r212339 in 2010.
This commit is contained in:
jilles 2015-08-16 12:57:17 +00:00
parent bc522110e3
commit 718cf25701
3 changed files with 21 additions and 2 deletions

View File

@ -191,9 +191,10 @@ readcmd(int argc __unused, char **argv __unused)
CHECKSTRSPACE(1, p);
if (backslash) {
backslash = 0;
startword = 0;
if (c != '\n')
if (c != '\n') {
startword = 0;
USTPUTC(c, p);
}
continue;
}
if (!rflag && c == '\\') {

View File

@ -121,6 +121,7 @@ FILES+= read4.0 read4.0.stdout
FILES+= read5.0
FILES+= read6.0
FILES+= read7.0
FILES+= read8.0
FILES+= return1.0
FILES+= return2.1
FILES+= return3.1

View File

@ -0,0 +1,17 @@
# $FreeBSD$
read a b c <<\EOF
\
A\
\
\
\
B\
\
\
C\
\
\
\
EOF
[ "$a.$b.$c" = "A.B.C" ]