Re: playing with IFS
Ray Andrews <[email protected]> Sun, 12 Apr 2026 15:44:43 -0700
| Newsgroups | gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <[email protected]> |
On 2026-04-12 15:16, Philippe Altherr wrote:
> The following should do the trick:
>
> output=( "aaa" " bb bb " "ccc" )
> output=(${(f)"$(cat <<< ${(F)output})"} )
I'm getting: "bad substitution" but I'll chew on it some more, thanks.
@dana:
> you felt the need to mess with IFS because you took out the ${(f)...},
not because you added the here string. if you really have to use sed for
some reason, just change that back
It's not accepting the '${(f)...}' for some reason.
> ... make it more
idiomatic, you should replace the sed itself using zsh's native
string-replacement facilities
In fact the replacement is quite complicated, I probably have to stick
with sed.
> you almost never need to mess with IFS like that in zsh. if you did need
to you could do
() { local IFS=$'\n'; ... }
I know it, that's why I'm asking. I'd much rather leave IFS alone.