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

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



On Fri, 20 Aug 2004, Haakon Riiser wrote:

> [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.
> 
> Hmm, strange that my shell gives 'bad substitution' when var_cmd
> is not defined.

So does Jason's, I'm sure.  Jason's point is that var_cmd should NEVER BE 
"not defined" in the _tla function.  It's defined at the point where it's 
declared, to be the second word on the command line.

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

It is a little odd that ${(P)unset+full} and ${(P)unset-empty} don't both 
give this error.  Compare ${-empty} and ${:-empty} as well.  In any case 
the workaround is to use the ${(P)unset:-empty} form.



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