Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: assigning part of the value of an element of an (associative) array
- X-seq: zsh-users 11057
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users List <zsh-users@xxxxxxxxxx>
- Subject: Re: assigning part of the value of an element of an (associative) array
- Date: Tue, 05 Dec 2006 09:13:52 -0800
- In-reply-to: <20061203231011.GA21818@sc>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20061203231011.GA21818@sc>
On Dec 3, 11:10pm, Stephane Chazelas wrote:
}
} 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?
Extra levels of subscripting don't work in assignment, no matter what
the type of the parameter. Even for a normal array,
ary[3][2]=x
does not assign to the 2nd character of the 3rd element. In effect,
the first subscript ary[3] gives a reference, but the second subscript
ary[3][2] gives only a value, so the assignment is meaningless.
The file mapping stuff in zsh is pretty primitive. It effectively
reads and/or (re)writes the entire file every time you manipulate it.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author