From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27141 invoked by alias); 9 Mar 2018 20:23:28 -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: 23224 Received: (qmail 6644 invoked by uid 1010); 9 Mar 2018 20:23:28 -0000 X-Qmail-Scanner-Diagnostics: from mail-lf0-f53.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.215.53):SA:0(-1.9/5.0):. Processed in 13.027233 secs); 09 Mar 2018 20:23:28 -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,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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:from:date:message-id:subject:to :cc; bh=SQsr2J9VdyKd58hx+6jCpuX0LXoRXhQ2eBodG0Dbe88=; b=B8A/eqqoZtlLZborune1UCFa0x4bTdfvPZepCz4CLLJiiU0+6ihP0pbib70yezeSGp B/UzpKXfpUQLj2poko5oOnWPOXYLdSlfppIv7+JhVEvFihB8yV0FFa+TtS5+eQwFdCQb Wu8S2u/ufbv0bu3/HBDh3UDlMcjZT5wRWPNKVNLau2VXGKXaF/pluGUeIrgJiN6mP8IJ exP0T0QXHJxOE+su9h8bfe6UwoVIHuyPbA60q4juInNEcpQ44HWH76UmqaLBbYuseYdj IcBerGph8soWklMHxZ6maORmMyjU3ovh0fliGNdqUqgoC3iTIVy3O5GDJA2FLuOBJaJL +k+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=SQsr2J9VdyKd58hx+6jCpuX0LXoRXhQ2eBodG0Dbe88=; b=QRPB9K7RpTm+eXoKsugrvy+SNOXSdn5dBavoMWRi8DT8oVEAX4lqp0N1KGGX5yCaMD ml2noDRSbIN67620sdXpr2Xb6BQFEXihYCRmvorp3A4ubKH4muKZ7ODISI6RxV+m84GW 6xppZH4kZFjeJlgj6wDG89If67KcLPhGRpDHzuxhItqJRoo1eH001woW6Ye1HDsZtYr6 UIhmfW69s3ryZsC+xHUqifzwVOPQQz0ZZY1UJbSdJ1y1OS31hNAjhTiFhNBuFudXAe4i IgcFfwqKwWfkFvk5b+MiF0Es22J0rRR46m42O1e9UdYb1P6h4VX6qGCJpdG7LbX/Zpo4 kBew== X-Gm-Message-State: AElRT7EVTzmaYkVFUlNbZVxxYcCGlAvF08eXqhDqQ/PoKgdvfw2gIJeV TPf9fHf08jnUYG5ewKROMncCsXi+MV2r955+57znDoX9 X-Google-Smtp-Source: AG47ELuoFS8P7ZbozdLUu3ffUdH7VzIh20yvzv5XlQIEEbLxhqaFX5jbssBaMBK3sTDrgD76em5wm2/domsXpqkUIQ4= X-Received: by 10.25.150.78 with SMTP id y75mr22855937lfd.81.1520626990686; Fri, 09 Mar 2018 12:23:10 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <2dcec644-7acb-5916-2858-2301206f1da8@eastlink.ca> References: <2dcec644-7acb-5916-2858-2301206f1da8@eastlink.ca> From: Bart Schaefer Date: Fri, 9 Mar 2018 12:23:10 -0800 Message-ID: Subject: Re: unmatched ' To: Ray Andrews Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" On Fri, Mar 9, 2018 at 9:50 AM, Ray Andrews wrote: > > $ c etc > > (eval):1: unmatched ' > > I suspect this abomination: > > /etc/DSHR's Blog: Using the official Linux overlayfs_files > > ... God knows why that's permitted, but I'm thinking that the single quote > is doing the obvious thing as far as 'eval' in concerned. Can I prevent > that? Or, if it must be an error, can I get eval to ignore it somehow? The > offending line is this: > > baz=(`eval print -l $bar $grepstring`) You really should never do this with "eval". Consider what happens if the file name is /etc/Why you should never `rm -rf /` (Obligatory warning: DO NOT TRY THAT AT HOME.) Why are you putting stuff like that file in /etc/ in the first place? It's not meant to be a scratch or documentation directory, it's supposed to contain system-wide configuration files. https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard > ... I want to sent the output of printing '$bar' after it's been piped > through the chain of greps that are built up and saved in the '$grepstring' If $bar is a file name with spaces in it, `eval print -l $bar` is going to split the name up on the spaces and write one "word" of the file name on each line. Is that actually what you intend? Otherwise unless $bar is an array, you don't need the -l option of print, because you're always printing just one line anyway. If $bar is a file name that begins with a hyphen, "print" is going to try to interpret that as options. Based on your description there must be a leading "|" in $grepstring. Don't do that. Assuming you've carefully sanitized $grepstring to avoid gotchas like unintentional `...` or $(...) substitutions, the closest you should ever get to what you're doing is baz=( `print -lr -- "${bar[@]}" | eval "$grepstring"` ) There's probably a better way to do your cascade of greps, too, such as building a file with one pattern per line and running a single "grep -f patternfile", but you haven't provided sufficient context.