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

Re: PATCH: bash-style substrings & subarrays



On Nov 17,  4:54pm, Peter Stephenson wrote:
}
} This implements the ${NAME:OFFSET} and ${NAME:OFFSET:LENGTH} syntax.
} This is basically for compatibility; we don't need the extra
} functionality, but it's a syntax people are nowadays assuming they can
} use.

I'm wondering whether :OFFSET:LENGTH shouldn't always use KSH_ARRAYS
semantics, or be a valid syntax only when KSH_ARRAYS is set?  If it's
for compatibility with people who are assuming it works, those people
are also going to assume it has zero-offset, aren't they?

There may be some error cases not yet caught:

schaefer<508> foo=123456789
schaefer<509> unset y x
schaefer<510> echo ${foo:$y:$x} 
zsh: bad math expression: illegal character: Ý

That Ý looks like uninitialized memory garbage.

-- 



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