sh
sh copied to clipboard
syntax: inconsistent formatting for subshell's closing parentheses
The syntax $(( and (( are ambiguous and when printing, we space the opening parentheses as in: ( (, as documented on the Caveats which is OK but we don't space for its closing parentheses. The output then looks inconsistent:
$ cat in.sh
( (foo) )
$ shfmt in.sh
( (foo))
It's not actually wrong but we can improve the output by making the space consistent:
( (foo) )
I think this suggestion makes sense - we don't strictly need the space between the closing parentheses for the sake of avoiding ambiguity, but adding the space makes the formatting more consistent, which is the point of the formatter.