News for hackers. Stuff that matters.
Re:Filenames and Pathnames in Shell: How to Do It Correctly by distcs on Tuesday June 20, 2023 @06:26AM (#36401996)
Zsh is not POSIX compatible. You need to enable many flags to make it POSIX compatible.

Zsh:

  $ A="foo bar baz"; for X in $A; do echo $X; done 
  foo bar baz
Dash:

  $ A="foo bar baz"; for X in $A; do echo $X; done 
  foo
  bar
  baz
Re:Filenames and Pathnames in Shell: How to Do It Correctly by Calzifer on Tuesday June 20, 2023 @06:55AM (#36402222)
> You need to enable many flags to make it POSIX compatible.

or use 'emulate sh' to enable many flags at once.

(and I personally would prefer if other shells would behave like Zsh and not word split unquoted variables by default)

Re:Filenames and Pathnames in Shell: How to Do It Correctly by JdeBP on Tuesday June 20, 2023 @07:28AM (#36402510)
This is true for the Bourne Again, Watanabe, and Korn shells too. The default mode is not the POSIX-conformant mode, but is the shell's native mode. This does not, however, make these shells "not POSIX compatible" any more than it makes the Z shell "not POSIX compatible". In all of them, one has to do non-default stuff, from setting particular environment variables through invoking the shell with a particular name to adding extra command-line options, to pick the POSIX-conformant mode.