Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Read file with escaped newlines into array
- X-seq: zsh-users 21540
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Read file with escaped newlines into array
- Date: Tue, 10 May 2016 09:15:34 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=WzKTeEcrKssK8dYEiDtqxoDjDcVTFApqe0Iptklv0kE=; b=UW1XPdNf/cWfJuACshSMTt8M8aCcpLaNhUAvD4J3+rhAt3tDcrAy8Z/Tx8FxvLRNxb IB3t0WsEV3RA9Uo9gz2808A5cj7hcHbbxYZPzXEcKp8CalecOxT4kfjtU3/CnCeIVmpk bTur9byFYnVjsegAPyIQ4G4tQezYj+fUGoSEWzbbHuSSQhrrbH3C5JW0tLPByak7s7EG Z+LNmF157BfYNwNCTZfiWO0XEzCmMjdqntJVb3MY+PZea2a/dbzGelmsyeWvK+BsdBtJ A33CWdjp4S1Mqe3AECfce3LFsNpaVO+6l72byQYYbXz0Y9hRwV1uEPl4EjGHvQ/zI+BL DjQQ==
- In-reply-to: <CAKc7PVAevePDEG6JRUCKXy9UY1jzR5HodSRVd_C=yK2T2UkL4w@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVCZzEfKkcWyPUb58ffmne6E8Eh6_CDpeLc0efd6hEQAow@mail.gmail.com> <151119111749.ZM8874@torch.brasslantern.com> <CAKc7PVAevePDEG6JRUCKXy9UY1jzR5HodSRVd_C=yK2T2UkL4w@mail.gmail.com>
On Tue, May 10, 2016 at 7:26 AM, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> On 19 November 2015 at 20:17, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>>
>> () { fc -ap -R the_given_file ; the_desired_array=( ${history} ) }
>
> This works, but I wonder, how it's possible that zsh/parameter
> variables such as $historywords are made local?
Special parameters can be made local simply by declaring them so. Or
are you asking "how" in the sense of what is done internally to make
it work?
In the case of $history et al., internally they reference the history
data structures directly, so "fc -p" implicitly makes $history refer
to the new temporary history, and then switch back to the real history
on "fc -P"; it isn't necessary to declare it local when using "fc
-ap".
Or perhaps you're asking how to populate a local variable called
"history" that does NOT track other history changes? In that case you
need to declare it with "local -h history" -- but if you do so, then
the real $history is hidden from all functions deeper in the call
stack, there is no way to get back to having $history refer to the
actual current history state until the declaring function returns.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author