Why does bash4 extend curly braces differently?

One of the legacy systems was upgraded to bash4, and most of its scripts stopped working. I narrowed it down before the braces expand within <(cmdA ...|cmdB ... file{1,2}|cmdZ ...).

To better illustrate the difference:

BEFORE (bash 3.2.25):

[root@host1:~]$ bash -version|head -1
GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
[root@host1:~]$ cat <(echo sort file{1,2})
sort file1
sort file2
[root@host1:~]$ join <(sed 's/\r//g;s/^[^:]*://' file{1,2}|LANG=C sort)
[root@host1:~]$

AFTER (bash 4.1.2):

[root@host2:~]$ bash --version|head -1
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
[root@host2:~]$ cat <(echo sort file{1,2})
sort file1 file2
[root@host2:~]$ join <(sed 's/\r//g;s/^[^:]*://' file{1,2}|LANG=C sort)
join: missing operand after `/dev/fd/63'
Try `join --help' for more information.
[root@host2:~]$ 

Is this a "hard-coded" (and expected?) Change for bash4? Or is the behavior of this extension controlled by some bash level settings (e.g. set -B/ set +B) and can be switched back to the old / obsolete / bash3 mode? I would rather change some kind of universal switch (instead of rewriting a bunch of scripts).

(bash3) - , (bash3) ...

+6
1

( , , , , , ).

, , . ​​ bash -4.0-alpha. CHANGES:

RR. .

, .

+4

Source: https://habr.com/ru/post/1015811/


All Articles