On 4/27/24 5:43 PM, Koichi Murase wrote:
When REPLY that is prepared by a value substitution ${ <list>; } is removed by <list>, the value substitution removes the previous-scope REPLY, which is not prepared by the value substitution, after the execution of <list>.$ bash-5.3-alpha --norc $ unlocal() { unset -v "$@"; } $ f2() { unlocal "$1"; echo "f2:$1=${!1}"; } $ f1() { local REPLY=1; a=${| f2 REPLY; }; echo "f1:REPLY=$REPLY"; } $ f1 f2:REPLY=1 f1:REPLY= Removing REPLY inside a value substitution is admittedly arguable. Nevertheless, it is still more consistent for value substitutions to remove only the REPLY they prepared, if present, and to avoid removing unrelated REPLY.
Thanks for the report. I agree that valsubs should only unset an instance of REPLY at the current function context. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature