Builtin 'read' data not saved

2014-01-02 Thread P Fudd
Hello all, I'm at my wit's end. This script is not working: = #!/bin/bash B=none echo 2 | while read -r A; do B=$A echo 1.B=$B done echo 2.B=$B == The output, from GNU bash, version 4.2.25(1)-release

Re: Builtin 'read' data not saved

2014-01-02 Thread P Fudd
Here's some more oddities: =failing.sh: #!/bin/bash R=1|2 IFS='|' read -r A B $R echo A=$A, B=$B Expected: A=1, B=2 Actual: A=1 2, B= fail2.sh: #!/bin/bash R=1|2 while IFS='|' read -r A B; do echo 1:A=$A, B=$B done $R echo 2:A=$A, B=$B Expected: 1:A=1, B=2 2:A=1, B=2

Re: Builtin 'read' data not saved

2014-01-02 Thread Davide Brini
On Thu, 2 Jan 2014 11:35:11 -0800, P Fudd f...@ch.pkts.ca wrote: Here's some more oddities: =failing.sh: #!/bin/bash R=1|2 IFS='|' read -r A B $R echo A=$A, B=$B Expected: A=1, B=2 Actual: A=1 2, B= fail2.sh: #!/bin/bash R=1|2 while IFS='|' read -r A B; do echo

Re: Builtin 'read' data not saved

2014-01-02 Thread Davide Brini
On Thu, 2 Jan 2014 11:35:11 -0800, P Fudd f...@ch.pkts.ca wrote: Here's some more oddities: Ok, the link I sent you is more about the issue you describe in your first message. See below for more on the new ones in this message. =failing.sh: #!/bin/bash R=1|2 IFS='|' read -r A B $R

Re: Builtin 'read' data not saved

2014-01-02 Thread Chet Ramey
On 1/2/14, 2:19 PM, P Fudd wrote: Hello all, I'm at my wit's end. This script is not working: This comes up regularly. The last time was less than a month ago: http://lists.gnu.org/archive/html/bug-bash/2013-12/msg00066.html If you have the Bash FAQ, this is covered in question E4. Greg

Re: Builtin 'read' data not saved

2014-01-02 Thread Chet Ramey
On 1/2/14, 2:35 PM, P Fudd wrote: Here's some more oddities: =failing.sh: #!/bin/bash R=1|2 IFS='|' read -r A B $R echo A=$A, B=$B Expected: A=1, B=2 Actual: A=1 2, B= This is a bug in bash-4.2. The expansion of $R is not supposed to be subject to the value of IFS. You can