diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:33:23 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:33:23 +0000 |
commit | 1d5cace9db9aef76f26b2d7ba54bbb76443b00b2 (patch) | |
tree | 314a15dd1aa103da13bdc83ba1d2105a290bc5ba /tests/nameref14.sub | |
parent | Initial commit. (diff) | |
download | bash-upstream/5.0.tar.xz bash-upstream/5.0.zip |
Adding upstream version 5.0.upstream/5.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/nameref14.sub | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/nameref14.sub b/tests/nameref14.sub new file mode 100644 index 0000000..7880b00 --- /dev/null +++ b/tests/nameref14.sub @@ -0,0 +1,43 @@ +# exporting namerefs and putting namerefs in temp env post bash-4.3 + +typeset -nx ref=var; +typeset -p ref + +var=foo; str='' +printenv ref # var +ref+=$str printenv ref # var +ref+="$str" printenv ref # var +ref=$ref$str printenv ref # var + +export ref # follows nameref and exports var + +printenv var # foo +ref+=$str printenv var # foo +ref+="$str" printenv var # foo +ref=$ref$str printenv var # foo + +# none of these should change ref; should follow the nameref and export var +unset var; unset -n ref; typeset -n ref=var + +echo before +typeset -p ref var + +echo first +ref=xxx typeset -p ref var + +echo invalid +var= ref=5 typeset -p ref var + +echo after +typeset -p ref var + +# ref isn't exported, so none of the printenvs should print anything +unset var ; unset -n ref +typeset -n ref=var; +typeset -p ref + +var=foo; str='' +printenv ref +ref+=$str printenv ref +ref+="$str" printenv ref +ref=$ref$str printenv ref |