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

Re: Typeset with array



On Jun 25,  4:39pm, Peter Stephenson wrote:
} Subject: Re: Typeset with array
}
} > torch% typeset -a array array[2]=two
} > typeset: array[2]: inconsistent type for assignment
} > torch% typeset -p array
} > typeset -a array
} > array=()
} 
} That's also correct.  typeset -a creates arrays, so "array" is
} successfully created; however, array[2] is a scalar with a scalar
} assignment, so that's an error with the "-a".

No disagreement, but then:

torch% typeset var=abcd var[2,3]=23
torch% typeset -p var
typeset var=a23d
torch% typeset -a array array[2]=(two)
typeset: array[2]: array elements must be scalar

So slices of scalars work, but not slices of arrays.



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