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

syntax question



${${(z)string}[1]}

... that does what I expect, and it's readable, however I'm curious why this does not say the same thing:

${(z)string[1]}

... How can that mean anything different?  It seems to just sorta get to the point more quickly and given the " (z) " it seem unintuitive that it would only print the first character just as:

${string[1]}

... does.  So in the second line the " (z) " seems to do nothing.  I'd expect the first two lines to be semantically the same and the third line to be a single character.  Is this explainable?  I know it's a nit-pick but I'd like to understand it.




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