diff options
author | Kevin Ballard <kevin@sb.org> | 2014-08-28 18:27:23 -0700 |
---|---|---|
committer | Kevin Ballard <kevin@sb.org> | 2014-08-29 12:48:45 -0700 |
commit | 7fce9e2411b9e63d949ad519f1b6a36744d3df4c (patch) | |
tree | 42db765cdece36a63a7f699debfc50dd8ebc059c /tests | |
parent | cc52a59e1ac7155123a314067cc8ad9f3affe491 (diff) |
Trim trailing newline on cmdsubst when IFS=''
When $IFS is empty, command substitution no longer splits on newlines.
However we still want to trim off a single trailing newline, as most
commands will emit a trailing newline and it makes it harder to work
with their output.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/read.in | 5 | ||||
-rw-r--r-- | tests/read.out | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/read.in b/tests/read.in index 53f9873b..f8787c5c 100644 --- a/tests/read.in +++ b/tests/read.in @@ -7,6 +7,11 @@ set -l IFS \t count (echo one\ntwo) set -l IFS count (echo one\ntwo) +echo [(echo -n one\ntwo)] +count (echo one\ntwo\n) +echo [(echo -n one\ntwo\n)] +count (echo one\ntwo\n\n) +echo [(echo -n one\ntwo\n\n)] set -le IFS function print_vars --no-scope-shadowing diff --git a/tests/read.out b/tests/read.out index 6d90fc0e..1098045d 100644 --- a/tests/read.out +++ b/tests/read.out @@ -1,6 +1,15 @@ 2 2 1 +[one +two] +1 +[one +two] +1 +[one +two +] 1 'hello' 1 'there' 1 'hello there' |