zsh-users
 help / color / mirror / code / Atom feed
* 1simple? questions
@ 2005-07-18 12:43 zzapper
  2005-07-18 13:01 ` Peter Stephenson
  2005-07-18 13:25 ` Nikolai Weibull
  0 siblings, 2 replies; 3+ messages in thread
From: zzapper @ 2005-07-18 12:43 UTC (permalink / raw)
  To: zsh-users

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


-- 
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 1simple? questions
  2005-07-18 12:43 1simple? questions zzapper
@ 2005-07-18 13:01 ` Peter Stephenson
  2005-07-18 13:25 ` Nikolai Weibull
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2005-07-18 13:01 UTC (permalink / raw)
  To: zsh-users

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.

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 1simple? questions
  2005-07-18 12:43 1simple? questions zzapper
  2005-07-18 13:01 ` Peter Stephenson
@ 2005-07-18 13:25 ` Nikolai Weibull
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolai Weibull @ 2005-07-18 13:25 UTC (permalink / raw)
  To: zsh-users

^--- What a horrible subject; very spamesque.

zzapper wrote:

> How can I echo/print an array with a carriage return after each
> element. Do I have to use a loop?

$ a=(1 2 3)
$ print -C 1 $a
1
2
3
$ 

Enjoy,
        nikolai

-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-07-18 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-18 12:43 1simple? questions zzapper
2005-07-18 13:01 ` Peter Stephenson
2005-07-18 13:25 ` Nikolai Weibull

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).