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

Re: Shell variable tables:setting value for elemet 1 overwrites element 0



wojciech.szenajch@xxxxxxxxxxx wrote:
> If this is the case, then any operation performed on element 0 should
> return error message. This is misleading that operations like
> TB[0]=zero; echo ${TB[0]} are accepted.

Yes, it was probably the wrong decision to accept [0] in this case.
I hope no one's relying on it, but you can't be sure.

> I wonder why this zsh behaviour is kept, if all other popular shells number
> arrays from 0.

The array feature was originally based around csh rather than ksh.  Accepting
0 as an alias for 1 dates from this time, I think.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************



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