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

Assign to outer parameter from function called by zargs



Hi. I'm trying to assign to a parameter set by an outer function from a function called by zargs.

Accessing instead of assigning works:

access_outer() {
  print ${outer}${1}
}
() {
  autoload -Uz zargs
  local outer=a
  zargs -n 1 -P 0 -- b c -- access_outer
}

results in:
ab
ac
as expected.

But assigning does not work as I was expecting:

assign_outer() {
  outer=${outer}${1}
}
() {
  autoload -Uz zargs
  local outer=a
  zargs -n 1 -P 0 -- b c -- assign_outer
  print ${outer}
}

results in:
a
and I was expecting to get:
abc
(or acb, I don't care about the order since I'm using -P 0 and I expect paralellism could interfere with the order)

What am I missing?

--
Sent with HEY


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