sh: Backslash-newline should not affect field splitting in read builtin.
This was originally broken in r212339 in 2010.
This commit is contained in:
parent
512e30ef9f
commit
4b6578dc8c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286826
@ -191,9 +191,10 @@ readcmd(int argc __unused, char **argv __unused)
|
||||
CHECKSTRSPACE(1, p);
|
||||
if (backslash) {
|
||||
backslash = 0;
|
||||
if (c != '\n') {
|
||||
startword = 0;
|
||||
if (c != '\n')
|
||||
USTPUTC(c, p);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!rflag && c == '\\') {
|
||||
|
@ -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
|
||||
|
17
bin/sh/tests/builtins/read8.0
Normal file
17
bin/sh/tests/builtins/read8.0
Normal file
@ -0,0 +1,17 @@
|
||||
# $FreeBSD$
|
||||
|
||||
read a b c <<\EOF
|
||||
\
|
||||
A\
|
||||
\
|
||||
\
|
||||
\
|
||||
B\
|
||||
\
|
||||
\
|
||||
C\
|
||||
\
|
||||
\
|
||||
\
|
||||
EOF
|
||||
[ "$a.$b.$c" = "A.B.C" ]
|
Loading…
Reference in New Issue
Block a user