Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 2 more questions
- X-seq: zsh-users 694
- From: Zefram <zefram@xxxxxxxxxxxxxxxxx>
- To: uli@xxxxxxxxxxxxxxxxxxxxxxxxxxxx (Uli Zappe)
- Subject: Re: 2 more questions
- Date: Fri, 21 Feb 1997 15:12:09 +0000 (GMT)
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <9702211128.AA08309@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> from "Uli Zappe" at Feb 21, 97 12:28:36 pm
Uli Zappe wrote:
>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)"
>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.
print -l "$ARRAY[@]" | command
but in the case of zero elements this will provide a single newline,
and it will produce ambiguous output if the array elements can contain
newlines.
command "$ARRAY[@]"
is the best interface, if it is feasible.
-zefram
Messages sorted by:
Reverse Date,
Date,
Thread,
Author