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

Re: In the tla completion function: "${(@P)var_cmd-*:FILE:_files}"



[Jason McCarty]

> > if $var_cmd is not defined, I'd expect the expansion to give the
> > string after the '-':
> 
> $var_cmd is always defined to something of the form "cmd_*" on line 658.
> I believe the P flag is evaluated before the - expansion, although I
> don't see an explicit mention of it in the manpage. The variable named
> by $var_cmd may or may not be defined, which is where the - expansion
> comes into play.
> 
> I'm afraid I came up with many of my fancy substitutions by trial and
> error ;-)

Hmm, strange that my shell gives 'bad substitution' when var_cmd
is not defined.

  % unset var_cmd
  % echo "${(@P)var_cmd-*:FILE:_files}"
  zsh: bad substitution

In your case, the result is

  % unset var_cmd
  % echo "${(@P)var_cmd-*:FILE:_files}"
  *:FILE:_files

Right?

-- 
 Haakon



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