Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 4
    Maybe ${(kM)parameters:#[[:alpha:]_][[:alnum:]_]#} (with extendedglob) for only the parameters that are variables. Commented Jun 22, 2017 at 15:39
  • 2
    for k in ${(koM)parameters:#[[:alpha:]][[:alnum:]_]#}; do; [[ ${(M)parameters[$k]:#association*} ]] || continue; print -- "$k"; done (extendedglob needs to be set) should give you a short list of variables to use depending on what data you are looking for. Changing [[:alpha:]] to [[:alpha:]_] will include associative arrays(or variables) which start with an underscore. Changing association* to scalar* or array* or integer* or *export* will give you the results of those types. "Variables and arrays" take a bit more work. Commented Oct 8, 2017 at 19:59