Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: passing arrays
- X-seq: zsh-users 5759
- From: Zefram <zefram@xxxxxxxx>
- To: Le Wang <lewang@xxxxxxxxx>
- Subject: Re: passing arrays
- Date: Sun, 19 Jan 2003 22:50:23 +0000
- Cc: Zsh users list <zsh-users@xxxxxxxxxx>
- In-reply-to: <20030119223453.39099.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20030119223453.39099.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
Le Wang wrote:
>Is it possible to pass an array into a function and
>have the function return an array?
The arguments to a function are an array, accessible through the
$1/$@/$argv parameters.
A function directly returns only a numeric status. To return any
other information, it must either assign to a parameter or generate
output (which can be captured using $(...)). The parameter assignment
technique is usually to be preferred, because it doesn't need to make any
system calls and it's easier for handling arrays. We already have some
mechanisms where the shell calls a user-defined function and receives
a string or array return code in the parameters $REPLY or $reply;
I suggest that where you need string or array returns you use these
parameter names to do it.
-zefram
Messages sorted by:
Reverse Date,
Date,
Thread,
Author