zsh-users
 help / color / mirror / code / Atom feed
* Passing array to function
@ 2016-09-30  7:15 Ignatius Reilly
  0 siblings, 0 replies; 4+ messages in thread
From: Ignatius Reilly @ 2016-09-30  7:15 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <1A643BF6-28C9-483E-9312-D8C856D41F0D__26800.772539764$1475219850$gmane$org@gmail.com>]

end of thread, other threads:[~2016-09-30 19:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-30  7:15 Passing array to function Ignatius Reilly
     [not found] <1A643BF6-28C9-483E-9312-D8C856D41F0D__26800.772539764$1475219850$gmane$org@gmail.com>
2016-09-30  7:45 ` Daniel Shahaf
2016-09-30  8:28   ` Mikael Magnusson
2016-09-30 18:26   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).