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

Re: Printing arrays for use with $()



On Aug 12,  4:52pm, DervishD wrote:
}
} >     array=( ${(ps:\0:)"$(print -rN -- $list)"} )
} 
}     I've posted a minute ago a possible solution, using more or less
} the same mechanism, only I was using ':' as the separator and not
} '\0' because it doesn't work for me.

I gather from your subsequent posting that you got it to work after all.

On Aug 12,  4:57pm, DervishD wrote:
}
}     array=( ${(ps:\0:)"$(print -N -- $list)"} )

I still recommend "print -rN" here.

}     Although I don't know why I need the double quotes if I use ":-"
} after the (ps) flag :? Is to avoid the shell splitting the entire
} string in the assignment before we can do the (ps)?

The results of $(...) and `...` are always subject to word splitting
unless quoted.  It's part of the definition of those substitutions.  
So, yes.



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