i have code below read array list
#!/usr/local/bin/bash function getlist { printf "%q/\n" "foo" printf "%q/\n" "bar" } ifs="$(printf ' \n\t')" # ifs=" " while read -r tmp; echo "test" echo $tmp done <<< $(getlist)
4.2 bash output
$ ./test.sh test foo/ bar/
4.4 output
$ ./test.sh test foo/ test bar/
however, if change ifs=" ", behave same 4.4 (but delimiter \n, right?). wonder change has been made between these 2 versions
the issue isn't read
it's not quoting herestring. if quote 4.4 results in both cases:
#!/usr/local/bin/bash function getlist { printf "%q/\n" "foo" printf "%q/\n" "bar" } ifs="$(printf ' \n\t')" # ifs=" " while read -r tmp; echo "test" echo $tmp done <<< "$(getlist)"
it's different in bash 4.4 because fixed deviation documentation found in release notes in:
z. bash no longer splits expansion of here-strings, documentation has said.
Comments
Post a Comment