On Mon, Oct 12, 2015 at 04:39:45PM -0700, Linda Walsh wrote:
> I wasn't sure if it put the "\n" at the end in a 1-line example.
<< and <<< always end with a trailing newline. This is 100% unavoidable
with that syntax. If your data stream needs NOT to end with a newline,
then you have to use < <(
On 10/12/15 7:39 PM, Linda Walsh wrote:
a= read a <<< x;echo $?
>>> 0
declare -p a
>>> declare -- a="x"
>>> # the manpage claims "one line is read from [the input], and the result
>>> # is split by words and assigns 1st word to 1st var and so forth, but
>>> # apparently the reading of
(Cc: Chet Ramey... forgot to send it to list...oop)
Chet Ramey wrote:
On 10/10/15 11:01 PM, Linda Walsh wrote:
a= read a <<< x;echo $?
0
declare -p a
declare -- a="x"
# the manpage claims "one line is read from [the input], and the result
# is split by words and assigns 1st word to 1st
On 10/10/15 11:01 PM, Linda Walsh wrote:
>> a= read a <<< x;echo $?
> 0
>> declare -p a
> declare -- a="x"
> # the manpage claims "one line is read from [the input], and the result
> # is split by words and assigns 1st word to 1st var and so forth, but
> # apparently the reading of 1 line is op
Geir Hauge wrote:
On Sat, Oct 10, 2015 at 08:01:05PM -0700, Linda Walsh wrote:
# this is odd: 2vars with content for 2:
unset a b
a= b= read a b <<< x y
declare -p a b
declare -- a="x"
declare -- b=""
# -- where did "y" go?
read a b <<< x y
is the same as
read a b y <<< x
If you
On 10/10/15 8:09 PM, isabella parakiss wrote:
> $ a= read a <<< x # this creates a variable in the current shell
> $ declare -p a
> declare -- a="x"
>
> $ b= mapfile b <<< x# this doesn't
> $ declare -p b
> bash: declare: b: not found
>
>
> Other shells don't seem to agree on what shou
On Sat, Oct 10, 2015 at 08:01:05PM -0700, Linda Walsh wrote:
> # this is odd: 2vars with content for 2:
> >unset a b
> >a= b= read a b <<< x y
> >declare -p a b
> declare -- a="x"
> declare -- b=""
>
> # -- where did "y" go?
read a b <<< x y
is the same as
read a b y <<< x
If you escap
isabella parakiss wrote:
$ a= read a <<< x # this creates a variable in the current shell
$ declare -p a
declare -- a="x"
$ b= mapfile b <<< x# this doesn't
$ declare -p b
bash: declare: b: not found
Very good point... more interesting is adding posix mode
to the mix:
#
$ a= read a <<< x # this creates a variable in the current shell
$ declare -p a
declare -- a="x"
$ b= mapfile b <<< x# this doesn't
$ declare -p b
bash: declare: b: not found
Other shells don't seem to agree on what should happen in this case, but
it'd be nice to have a more consistent