I have a script:
#!/bin/bash
{ read a
read b
} <<< $(echo a; echo b)
declare -p a b
I wrote it to f
, did chmod +x ./f
, and expected that bash ./f
and ./f
would be identical.
They aren't:
~/dev/test[1]$ ./f
declare -- a="a b"
declare -- b=""
~/dev/test[2]$ bash ./f
declare -- a="a"
declare -- b="b"
I figured out that bash ./f
is using /usr/local/bin/bash
which is version 5.0.16, and that ./f
using /bin/bash
is version 3.2.57.
What changed between those versions to make this evaluate differently? Is this a bug that got resolved?