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

Re: 2 more questions



>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. It works, of course, with a for-do
>   loop but that's not efficient enough.

echo $ARRAY | xargs -n 1 command

/tg




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