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

assigning part of the value of an element of an (associative) array



Hi,

One can do:

print -r -- ${array[1][2]}

to get the second byte (character?) of the first element of
$array, or

first_byte=${mapfile[file.txt][1]}

One can also do:

scalar[1,3]="foo"

To assign parts of a scalar.

But how would you assign bytes 1 to 3 of $mapfile[file.txt] for
instance?

mapfile[file.txt][1,3]=foo

doesn't seem to work.

Thanks,
Stéphane



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