#544·sh

v4: consider redesigning SpaceRedirects (-sr) into an option to space all operators and delimiters

Author: mvdanCreated Apr 18, 2020Updated Sep 9, 2026
Labelsenhancementhelp wanted

We have the -sr flag, which makes the tool format redirections like > file instead of >file. It seems like the similar kind of spacing would be useful in other scenarios:

  • (( expr )) instead of ((expr)), including $(( too
  • << EOF instead of <<EOF
  • ( stmts ) instead of (stmts), including $( too
  • <( stmts ) instead of <(stmts)
  • arr=( elems ) instead of arr=(elems)

The point behind unifying this under a single flag is that it avoids having half a dozen flags, and supposedly, people who want a subset of these wouldn't mind having the others too.

This is something we could add in v3, removing the current -sr in v4 to not break backwards compatibility in the current major version.

CC @tianon, who recently raised the case for arrays in #525 CC @PeterDaveHello @alok, who originally raised the case for redirects in #243 CC @DKroot, who raised the case for arithmetic expressions in #543