Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Change on stdout
- X-seq: zsh-users 14272
- From: Omari Norman <omari@xxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Change on stdout
- Date: Fri, 31 Jul 2009 15:43:06 -0400
- In-reply-to: <20090731194012.GA8332@cameron>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20090731175207.46af5c20.tartifola@xxxxxxxxx> <20090731194012.GA8332@cameron>
On Fri, Jul 31, 2009 at 03:40:12PM -0400, Omari Norman wrote:
> On Fri, Jul 31, 2009 at 05:52:07PM +0200, tartifola@xxxxxxxxx wrote:
> > I need to operate a transformation on the standard output
> > of a command. The output is a list of numbers
> >
> > 1 5 8 ...
> >
> > and I like to have it transformed in
> >
> > a1=1,a2=5,a3=8,...
>
> This is inelegant (like my knowledge of the shell) but should work.
Whoops, that should be:
$ nums=$(your_command)
$ numArray=( ${=nums} )
$ for (( n = 1; n <= ${#numArray}; n++)); do
echo -n "a${n}=${numArray[$n]},"
done; echo
Forgot the "do" in there, and the semicolon after the "done".
--
Why wait? Call now!
Messages sorted by:
Reverse Date,
Date,
Thread,
Author