Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • So, to clarify in my own mind, ${(~j[|])names:r} treats | as an (extended) glob operator because of the ~ flag, but does not treat [ and ] specially in the expansion of names because unquoted variable expansions are not subject to split+glob by default? Commented Mar 31, 2023 at 23:44
  • @steeldriver, yes ${(~j[string])array} applies globsubst to that join string only, while $~var applies globsubst to the whole expansion (and $=var does splitting so $~=var in zsh is like the $var of sh, something you almost never want). Commented Apr 1, 2023 at 7:54
  • Thank you Stéphane. Unfortunately, I should have also stated that this will be running on a NAS (Synology) for which I only have access to BASH. At least, by default. Commented Apr 2, 2023 at 14:52