Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Passing array to function
- X-seq: zsh-users 21993
- From: Ignatius Reilly <turnbuckle@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Passing array to function
- Date: Fri, 30 Sep 2016 02:15:55 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=TT6naNLXNzBMbTtbWQlKUnZF+iu4rUvAZL248YKXycM=; b=HPvGG9tuG8vGWULKSSDr63XiEibIb/E49/5t1UBKOo/kcAYPZ7B1EHqASY7bljFHfj eteyQ2e4Hpp2gdquFoB/OCaFUz1zCqOYQUW39fy4rIJ81HnT6y8p7NAAkjLdUkMHaqZg cHOuMF/g+WYRI17J7EEW3wPyyLAYv7E/9b1fgCkdFJrRgCt5KTVSRgg6F+Bwe8M5mXoO ek0Z29IuFdSjSwRnSZDqSeymXCvNcj1cyFNW/C838bgT/QjbJJsGyfySoWl0Sfin2Rj8 erSZF7CMJtNmcI1JMmT3FGf+drUXl3CWmqAll+aF95e/jRKfKEnk3vLi3Kfgx8w4tRQy +Z3g==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
I have the following function:
addtoarray() { [[ -d $1 ]] && myarray=($1 $myarray) }
which works as expected, prepending an element to an array only if its an
existing directory. I'd like to rewrite this function so that I can pass
the array name as a parameter like so:
addtoarray /usr/foo myarray
but I can't figure out how. I've tried everything I can think of without
any success.
Thanks
Messages sorted by:
Reverse Date,
Date,
Thread,
Author