Re: read and env variables + POSIX => SEGFAULT

2015-10-13 Thread Greg Wooledge
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 < <(

Re: read and env variables + POSIX => SEGFAULT

2015-10-12 Thread Chet Ramey
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

Re: read and env variables + POSIX => SEGFAULT

2015-10-12 Thread Linda Walsh
(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

Re: read and env variables + POSIX => SEGFAULT

2015-10-12 Thread Chet Ramey
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

Re: read and env variables + POSIX => SEGFAULT

2015-10-11 Thread Linda Walsh
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

Re: read and env variables

2015-10-11 Thread Chet Ramey
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

Re: read and env variables + POSIX => SEGFAULT

2015-10-11 Thread Geir Hauge
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

Re: read and env variables + POSIX => SEGFAULT

2015-10-10 Thread Linda Walsh
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: #

read and env variables

2015-10-10 Thread isabella parakiss
$ 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