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

Re: 1simple? questions



zzapper wrote:
> Hi,
> Q1
> How can I echo/print an array with a carriage return after each element. Do I
>  have to use a loop?

Just use rc_expand_param:

  print ${^array}\\r

Careful, however:  you still get the spaces between elements from
"print".  You can suppress those by joining the array elements first
using print escapes:

  print ${(pj:\r:)array}

(You did mean carriage return, didn't you?  You didn't simply want to
print one element of the array per line

  print -l $array

?)

pws


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************



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