On Thu, 31 Aug 2023 12:05:21 -0400 (EDT) dkro...@gmail.com wrote: > Configuration Information [Automatically generated, do not change]: > Machine: x86_64 > OS: darwin20.6.0 > Compiler: clang > Compilation CFLAGS: -DSSH_SOURCE_BASHRC > uname output: Darwin San-Francisco-iMac.local 20.6.0 Darwin Kernel Version > 20.6.0: Thu Jul 6 22:12:47 PDT 2023; > root:xnu-7195.141.49.702.12~1/RELEASE_X86_64 x86_64 > Machine Type: x86_64-apple-darwin20.6.0 > > Bash Version: 5.2 > Patch Level: 15 > Release Status: release > > Description: > I've run into a regression in one of my scripts after upgrading Bash > from 5.1.16 to 5.2.15 via HomeBrew on a Mac. > I was able to narrow it down to the Bash upgrade itself. The problem seems to > be a pretty serious one that can affect a lot of scripts. > > Repeat-By: > > # Bash 5.1.16: success > # Bash 5.2.15: syntax error near unexpected token `}' > var2=$(time { echo foo; echo bar; })
This looks like a casualty of the changes made for 5.2 that have it validate syntax recursively. The error message suggests that "time" is not considered to be a keyword there, even though it is. In any case, here is a temporary workaround for this regression. $ declare -- BASH_VERSION="5.2.15(1)-release" $ var2=$(:; time { echo foo; echo bar; }) real 0m0.000s user 0m0.000s sys 0m0.000s -- Kerin Millar