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

Re: var=$( typeset "$1" ) ... not within a function.



On Fri, Oct 21, 2022 at 4:25 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> So, to add case sensitivity to the output of typeset I just run
> it thru a 'sed' for filtering and colorizing (which you can't see below
> of course).  So, if I want to know if, case insensitively, what "*path*"
> might mean to the shell

Try this:

  function print-params() {
    emulate -L zsh -o extened_glob
    local names=( ${parameters[(I)(#i)$~1]} )
    if (( $#names )); then
      typeset -p -- $names
    fi
  }

  print-params '*path*'

You can do the same thing with other associative arrays: aliases,
functions, commands, etc.

Roman.




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