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

Re: 2 more questions

uli (Uli Zappe) scandalously alleged:                          (on Feb 21, 1997)
> Hi,
> sorry I have to bother you yet again, but I have two more problems  
> left that I couldn't solve with the zsh documentation:
> 1. Is there a way in zsh to pass the standard output to a parameter 
>    instead of the standard input of a command? I.e. I have
>       command1 | command2 parameter
>    and need the output of command1 as the parameter for command2

command2 `command1`

I can see how you were probably looking in the wrong place :)

> 2. How do I pipe the elements of an array into a command? If I do a
>       echo $ARRAY | command
>    the elements are separated only by whitespace instead of newlines 
>    which will not work correctly especially if the elements possibly
>    contain whitespace themselves. It works, of course, with a for-do
>    loop but that's not efficient enough.

echo ${(j:\n:)ARRAY} | command

umm, there may be a way to pipe the variable to stdin of command
without the use of echo ... I'd be interested to know what it is.

again you were probably looking in the wrong places for this answer

I learnt these tricks and a whole lot more, or at least worked out
where to look for info in the man pages when I did a 
man -T ps zshall > zshdocs.ps (I think? from memory, anyway), to
create the man page as a postscript file, which I then printed, and
read like a book, making notes on all those cool features.  Its a
great way to more fully appreciate zsh, if you can afford the


Duncan Sargeant, keraunothnetophobic.   WWW: http://www.ucc.gu.uwa.edu.au/~dunc/
Orr would be crazy to fly more missions and sane if he didnt, but if he was sane
he had to fly them.  If he flew then he was crazy and didn't have to; but if he
didn't want to he was sane and had to.  Yossarian was moved deeply and let out a
respectful whistle at the absolute simplicity of this clause of Catch-22. --jh

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