On Sun, Nov 08, 2020 at 09:12:13PM +0100, chiasa.men wrote:
> Ahoy,
>
> how to get the following idiom ash-like translated? (I just called busybox on
> my raspbian buster)
>
>
> echo '12 34' | read a b ; echo "'${a}''${b}'"
> ''''
>
> Doesnt the manual state that "The read utility shall read a single logical
> line from standard input into one or more shell variables."
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/read.html
>
> IFS
>     Determine the internal field separators used to delimit fields; see Shell
> Variables.
>
> And
> The shell shall set IFS to <space> <tab> <newline> when it is invoked.
>

Per POSIX 
(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_12),
commands in a pipeline all run in their own subshell unless your shell has an
extension to circumvent this. So read won't affect the environment outside the
pipeline.

The usual way to solve this is:
> read a b <<EOF
$(echo 12 34)
EOF
> echo "$a" "$b"
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to