summaryrefslogtreecommitdiff
path: root/tests/dollar-star7.sub
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2014-02-26 09:36:43 -0500
committerChet Ramey <chet.ramey@case.edu>2014-02-26 09:36:43 -0500
commitac50fbac377e32b98d2de396f016ea81e8ee9961 (patch)
treef71882366b98fedf1a88a063103219a4935de926 /tests/dollar-star7.sub
parent4539d736f1aff232857a854fd2a68df0c98d9f34 (diff)
downloadbash-ac50fbac377e32b98d2de396f016ea81e8ee9961.tar.gz
Bash-4.3 distribution sources and documentationbash-4.3
Diffstat (limited to 'tests/dollar-star7.sub')
-rw-r--r--tests/dollar-star7.sub30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/dollar-star7.sub b/tests/dollar-star7.sub
new file mode 100644
index 00000000..72d6c24f
--- /dev/null
+++ b/tests/dollar-star7.sub
@@ -0,0 +1,30 @@
+# if IFS side effects in ${IFS=} assignments take place, how do you cope with
+# later changes to IFS in the same set of expansions? You've already
+# committed to using the first character of the (old) IFS to expand $* in
+# the previous expansions, and changing it to not include ' ', for instance,
+# results in the first couple of ${*} below not being split at all
+
+set -f -- a b c
+
+unset -v IFS
+printf '<%s> ' ${*}${IFS=}${*}${IFS:=-}"${*}"
+echo
+printf "after 1: IFS "
+echo "${IFS-unset}"
+recho "$*"
+
+set -f -- a 'b c' d
+unset -v IFS
+printf '<%s> ' ${*}${IFS=}${*}${IFS:=-}"${*}"
+echo
+printf "after 2: IFS "
+echo "${IFS-unset}"
+recho "$*"
+
+unset -v IFS
+recho $*
+recho "$*"
+
+IFS=' '
+recho $*
+recho "$*"