summaryrefslogtreecommitdiffstats
path: root/tests/varenv15.sub
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 18:33:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 18:33:23 +0000
commit1d5cace9db9aef76f26b2d7ba54bbb76443b00b2 (patch)
tree314a15dd1aa103da13bdc83ba1d2105a290bc5ba /tests/varenv15.sub
parentInitial commit. (diff)
downloadbash-1d5cace9db9aef76f26b2d7ba54bbb76443b00b2.tar.xz
bash-1d5cace9db9aef76f26b2d7ba54bbb76443b00b2.zip
Adding upstream version 5.0.upstream/5.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/varenv15.sub')
-rw-r--r--tests/varenv15.sub38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/varenv15.sub b/tests/varenv15.sub
new file mode 100644
index 0000000..52c8a94
--- /dev/null
+++ b/tests/varenv15.sub
@@ -0,0 +1,38 @@
+# check saving and restoring positional parameters around function calls
+
+f()
+{
+ echo $FUNCNAME: "$@"
+}
+
+f1()
+{
+ f {1..50}
+ echo $FUNCNAME: after: $@
+}
+
+set -- {1..100}
+
+f1 {1..20}
+echo done: $@
+
+f3()
+{
+ echo $FUNCNAME:$1
+ shift
+ if [ $# -le 0 ]; then
+ return
+ fi
+ f3 "$@"
+}
+
+f3 {1..20}
+
+# now let's try source with and without positional parameters
+
+set -- {1..20}
+echo before source: "$@"
+. ./varenv15.in
+echo after source 1: "$@"
+. ./varenv15.in one two three four five six seven eight nine ten
+echo after source 2: "$@"