Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: playing with IFS





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.






Messages sorted by: Reverse Date, Date, Thread, Author