From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 23683 invoked from network); 16 May 2020 07:04:03 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 16 May 2020 07:04:03 -0000 Received: (qmail 12043 invoked by alias); 16 May 2020 07:03:55 -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: List-Unsubscribe: X-Seq: 24840 Received: (qmail 19448 invoked by uid 1010); 16 May 2020 07:03:55 -0000 X-Qmail-Scanner-Diagnostics: from mail-oi1-f170.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25812. spamassassin: 3.4.4. Clear:RC:0(209.85.167.170):SA:0(-1.9/5.0):. Processed in 1.953442 secs); 16 May 2020 07:03:55 -0000 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.167.170 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xpcbfWklKwyAwzvR9THveKu78b1rtWRFnwUhd1xm5b8=; b=qC2yvaeyoTxW8VolRdjEQ16nz4gUM0By0dvuObCiH6YXGFXTnbi1FTzWDIUFfDq5t8 Mlwi/5Rq9kPPjEZxvexxY4DqjvQkrluIJ3shB8OeQh5RhDGSFmJjdWCwohyUHi7BGacu vHTJWCMG7vIQ6+qyhHIdkLC0jPZZZfY9ljSnMdGfSQ2Stoij9oVJ/OY08yuAkb/HC5UH cxNoPEHkAyv6IUtu1LeOWOGjgfgEPfOVzSugdhg84XskdOnxy4Chy96xESB+cRs7DSfr nQIxlvtRkZrxr8woN5JMInqqeCZIepRuc7Y729/fKr1SbGzfY07tcgxG87icoQmCp/UU lCIQ== X-Gm-Message-State: AOAM53221n9Ht7DLCw4ZbsQnejdk3vQSvwcUITrrQS4YKXI8P3DRdUMG WePfCQAwkbk+bct+5iEHzA++MCdH4d4x2heaaDAlipNDJJzBJg== X-Google-Smtp-Source: ABdhPJxj+zDsyTVxRfb7AG4hzff5JJcbrVGCWAtCJ1+tKZ3UKeGyIfGdqgw00Z+NcZuwt0lkD/ITGx6VE4eDwMUiB/I= X-Received: by 2002:aca:c546:: with SMTP id v67mr4459376oif.84.1589612600511; Sat, 16 May 2020 00:03:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Sat, 16 May 2020 00:03:09 -0700 Message-ID: Subject: Re: Expanding a variable extracted from another file To: TJ Luoma Cc: Zsh MailingList Content-Type: text/plain; charset="UTF-8" On Fri, May 15, 2020 at 11:48 PM TJ Luoma wrote: > > Assume I have a plain text file "$HOME/MyReferenceDoc.txt" which has > these lines: > > "$HOME/glue/sticks" > "$HOME/foo/bar" > "$HOME/work/files" > > And I want to get the matching line which has '/foo/' MYVAR=${(f@M)$(<~/MyReferenceDoc.txt):#*/foo/*} > My question is: How can I tell zsh the it should expand the "$HOME" in > "$MYVAR" to "/home/james"? print -r -- ${(Qe)MYVAR} Or leave out the Q if you want the double-quotes preserved.