I’m using Zsh’s parameter expansion flags to split a string into an array.
This works:
string="one
two"
array=("${(f)string}")
echo "${array[1]}"
# Returns:
# one
This does not work:
string="one\ntwo"
array=("${(f)string}")
echo "${array[1]}"
# Returns:
# one
# two
How can we make the expansion interpret the \n as a newline?