From 7fce9e2411b9e63d949ad519f1b6a36744d3df4c Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Thu, 28 Aug 2014 18:27:23 -0700 Subject: 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. --- tests/read.in | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/read.in') 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 -- cgit v1.2.3