On Fri, Jan 12, 2024, at 2:06 PM, Robert Elz wrote:
> ps: the use of process substitution there is just silly, it would work
> just as well, and be easier to understand if written:
>
>       printf '\\\nabc' | { read -N1; read -r b c; }; declare -p REPLY b c

Presumably Greg was just preventing the implicit pipeline subshell
from swallowing the variables.

        bash-5.2$ printf '\\\nabc' | { read -N1; read -r b c; }; declare -p 
REPLY b c
        bash: declare: REPLY: not found
        bash: declare: b: not found
        bash: declare: c: not found

For these self-contained experiments, printing the values from
within the subshell is probably fine.

        bash-5.2$ printf '\\\nabc' | { read -N1; read -r b c; declare -p REPLY 
b c; }
        declare -- REPLY="a"
        declare -- b="bc"
        declare -- c=""

-- 
vq

Reply via email to