From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9734 invoked by alias); 10 May 2016 16:15:38 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21540 Received: (qmail 12445 invoked from network); 10 May 2016 16:15:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=WzKTeEcrKssK8dYEiDtqxoDjDcVTFApqe0Iptklv0kE=; b=BNOq2R94JCGtQj848xsQFWWsRYp0hWW6nBCT14u3FZJ+gPpP+bSl0WWA+aA09qxLqw QrIajaARmREAifbPDVj8IIr46PK29u3JEfWzFpK1CZdZYFU0htdNimUNa0ePCSeFq2K/ yzgW2jkJADlfubY+MrVrF3KQC8GkIEstTMWtdjJBrfgy7xM5EYiWp3/UalVJE9fYkH1Y 4HUvIGWQvdygg8Q2KadW+XjzcXOEKHC2bInLe9YBJgucb8Rs0nLULhGfbQzvJ3P+GGoo CkCGH7YXzL2wNeJsPJPzXRJ5AmmJO5C/4A460mTgjdjEd3o/7E5wmJV/q5FF6Mx4StZq EUhA== X-Gm-Message-State: AOPr4FVtL8vge46eqm5qxuMy7Ba4PTmLNwCJMZcu0mk+Xl5Kgal3EucRPhJVpp38bAoE63m8bbTkR+ArcTiQWw== MIME-Version: 1.0 X-Received: by 10.112.161.41 with SMTP id xp9mr17015742lbb.133.1462896934486; Tue, 10 May 2016 09:15:34 -0700 (PDT) In-Reply-To: References: <151119111749.ZM8874@torch.brasslantern.com> Date: Tue, 10 May 2016 09:15:34 -0700 Message-ID: Subject: Re: Read file with escaped newlines into array From: Bart Schaefer To: Zsh Users Content-Type: text/plain; charset=UTF-8 On Tue, May 10, 2016 at 7:26 AM, Sebastian Gniazdowski wrote: > On 19 November 2015 at 20:17, Bart Schaefer 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.