diff options
author | jilles <jilles@FreeBSD.org> | 2009-11-14 22:08:32 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2009-11-14 22:08:32 +0000 |
commit | 6655f1214ac30cf0a54e74be98803f8e2e02aa4c (patch) | |
tree | 2126dfcd9ac27fc8b6d6d502f33139419737a913 /tools | |
parent | 3579059b778aedda16c1d467ccc2dd42a542e11e (diff) | |
download | FreeBSD-src-6655f1214ac30cf0a54e74be98803f8e2e02aa4c.zip FreeBSD-src-6655f1214ac30cf0a54e74be98803f8e2e02aa4c.tar.gz |
sh: Allow a newline before "in" in a for command, as required by POSIX.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/bin/sh/parser/for1.0 | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/regression/bin/sh/parser/for1.0 b/tools/regression/bin/sh/parser/for1.0 new file mode 100644 index 0000000..f4b38d4 --- /dev/null +++ b/tools/regression/bin/sh/parser/for1.0 @@ -0,0 +1,29 @@ +# $FreeBSD$ + +nl=' +' +list=' a b c' +for s1 in "$nl" " "; do + for s2 in "$nl" ";"; do + for s3 in "$nl" " "; do + r='' + eval "for i${s1}in ${list}${s2}do${s3}r=\"\$r \$i\"; done" + [ "$r" = "$list" ] || exit 1 + done + done +done +set -- $list +for s2 in "$nl" " " ";"; do # s2=";" is an extension to POSIX + for s3 in "$nl" " "; do + r='' + eval "for i${s2}do${s3}r=\"\$r \$i\"; done" + [ "$r" = "$list" ] || exit 1 + done +done +for s1 in "$nl" " "; do + for s2 in "$nl" ";"; do + for s3 in "$nl" " "; do + eval "for i${s1}in${s2}do${s3}exit 1; done" + done + done +done |