[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: document that read built-in can't return zero-length string in the m
From: |
Lawrence Velázquez |
Subject: |
Re: document that read built-in can't return zero-length string in the middle of input |
Date: |
Fri, 12 Jan 2024 14:23:42 -0500 |
User-agent: |
Cyrus-JMAP/3.9.0-alpha0-1374-gc37f3abe3d-fm-20240102.001-gc37f3abe |
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
- Re: document that read built-in can't return zero-length string in the middle of input, (continued)
- Re: document that read built-in can't return zero-length string in the middle of input, Chet Ramey, 2024/01/11
- Re: document that read built-in can't return zero-length string in the middle of input, Greg Wooledge, 2024/01/11
- Re: document that read built-in can't return zero-length string in the middle of input, alex xmb sw ratchev, 2024/01/11
- Re: document that read built-in can't return zero-length string in the middle of input, Ángel, 2024/01/11
- Re: document that read built-in can't return zero-length string in the middle of input, Robert Elz, 2024/01/12
- Re: document that read built-in can't return zero-length string in the middle of input, Greg Wooledge, 2024/01/12
- Re: document that read built-in can't return zero-length string in the middle of input, Robert Elz, 2024/01/12
- Re: document that read built-in can't return zero-length string in the middle of input,
Lawrence Velázquez <=
- Re: document that read built-in can't return zero-length string in the middle of input, Greg Wooledge, 2024/01/12
- Re: document that read built-in can't return zero-length string in the middle of input, Chet Ramey, 2024/01/15
- Re: document that read built-in can't return zero-length string in the middle of input, alex xmb sw ratchev, 2024/01/15