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

Re: parameter substitution used in _values



Oliver Kiddle wrote:

> Any ideas why the difference between using $1 and $a here below:
> 
> % set -- '-Opath'
> % a="$1"
> % echo ${(@P)1[3,-1]}
> 9XZfims
> % echo ${(@P)a[3,-1]}
> /usr/lib/jdk1.3/bin /usr/bin /bin ... etc ...
> 
> I'm guessing that the 9XZfims is the list of single letter options but
> why that and not the value of $path? This stuff is used at the beginning
> of _values where it parses its options so it looks to me like _values
> won't work with no space between -O and its argument.

Oh rats.

The problem is that the positional parameters are internally turned into
`$argv[n]'.  And, as one can see, 

  % a=(-opath)
  % echo ${(@P)a[1][3,-1]}

doesn't `work' either. The reason is that fetchvalue() applies only one
subscript level, so the second fetchvalue() for the P flags doesn't get
`path' in those cases.

Obviously I wasn't aware of that and I don;t like it either, but see no
simple fix (for the C-code).

In the shell code we have to use `${(@P)${1[1,3]}}' for now.  Oliver, if
you have your hands in there anyway, could you?


Bye
  Sven


-- 
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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