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=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY
autolearn=ham autolearn_force=no version=3.4.4
Received: (qmail 10190 invoked from network); 10 Feb 2021 15:47:59 -0000
Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368)
by inbox.vuxu.org with ESMTPUTF8; 10 Feb 2021 15:47:59 -0000
ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1612972079;
b=IcIO2t6xJKW5cnG2347a1dX0DTd+d2k6i4nLfCaOgZ0aji6vpTDbgmTJPz9DoEzXb8Z6xmWPBq
OYOA807tOsX69shhUSA7XiH5koua6SmzUQy0FQoy4k/mjgFDlSKB+SVoUs4KwoQ6dUStv/7B/V
hzguqXY4JqTW5JbBMzWYFbcNDPvm5taRU3v+M/OjrroFibADGuc39aR4Z7lxAHum7B2aq6ocKJ
LD4tOifhH/0wYbw6R4+XweMFKIHzeHXmCtzI0RZLzoh2a42kWtXBIayQFYdkApeNcxiZ5Ls6Lq
WTT+progOKVg0Ikvdz/Q3V9wnauJvpypYPQJ/Qteokh1MA==;
ARC-Authentication-Results: i=1; zsh.org;
iprev=pass (smtpq1.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.96;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1612972079;
bh=/pCjAwJXlnHsyNMDkydaRC/hdrD1HIXkh0UzuBdwQ94=;
h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help:
List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:
References:In-Reply-To:Message-ID:To:From:Date:DKIM-Signature:
DKIM-Signature;
b=UfBx9U8XJRZYhhrWK6JXoAY34tjg+0gJStWy7Z9rZsKGKFqs1gjV/3h7+NDkMGfja3llJQSxCg
7Km+vyOx1xIaW52YwtSUWq0c1uxCgRprUv/Ecl4UfWh6NaIZjHhef7nXtc/mN2sawvRMwCX6Yj
YtknMnXvha3QyfxW37yB4ocgcm0Mc2rTfH7bcyhC9ZlfDytkCkQmkZrzBKJ/3ggRqqAVdMqmUF
6K7pQ5OVA8qznzv9iCWrIJhTkNUITSzxVCM4Fql+b8r+1hpPW0xj/LKInSygRGbschNmAr+4ui
TAQ/q5TUHN9pu3+LoE24KKYkL2w2diEesDlVUC1os22sjw==;
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org;
s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:
List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding:
Content-Type:MIME-Version:Subject:References:In-Reply-To:Message-ID:To:From:
Date:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:
Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID;
bh=h0RS0TxxuUR/XvuhNZjVsVdipAIx+FFwxDYg0j+dJk4=; b=NSX4zwwS+F8DupORM5j92qEY1k
WK5CEqBBoiApyAYznlFL7A0C+h0EHrmcoSHocJDx7UQ7aJLpc5WvM/fioSZkDdO81qwqfuNaNjotn
vwR8XaxZqpIfKykjzOxTuA+nXoG/o/jfTJOHacyUsOgtUyo+qd4lTTce58xvfCInTOdSNwbNr4eBW
VTGQR/QVMb3UnXbJeMsOGE524qgBrDPOhStdxT7scYKXhbacVV3r97PbJLEqhB8+QnPp9PIXZkRbH
6czgN4bZkEgOFTaGTvTR2TDr2/vGqBC05jDLUntxHSCmDz3XR4vwKOuIpsjwTpQhyDUXQxE0hAgtc
9TP52A0w==;
Received: from authenticated user by zero.zsh.org with local
id 1l9rig-000ACi-UN; Wed, 10 Feb 2021 15:47:58 +0000
Authentication-Results: zsh.org;
iprev=pass (smtpq1.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.96;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
Received: from smtpq1.tb.ukmail.iss.as9143.net ([212.54.57.96]:54832)
by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128)
id 1l9riF-0009pO-BH; Wed, 10 Feb 2021 15:47:31 +0000
Received: from [212.54.57.81] (helo=smtp2.tb.ukmail.iss.as9143.net)
by smtpq1.tb.ukmail.iss.as9143.net with esmtp (Exim 4.86_2)
(envelope-from
)
id 1l9riF-0005fB-7O
for zsh-users@zsh.org; Wed, 10 Feb 2021 16:47:31 +0100
Received: from oxbe20.tb.ukmail.iss.as9143.net ([172.25.160.151])
by smtp2.tb.ukmail.iss.as9143.net with ESMTP
id 9riFlf125hdRd9riFl8zL2; Wed, 10 Feb 2021 16:47:31 +0100
X-Env-Mailfrom: p.w.stephenson@ntlworld.com
X-Env-Rcptto: zsh-users@zsh.org
X-SourceIP: 172.25.160.151
X-CNFS-Analysis: v=2.4 cv=MqCXV0We c=1 sm=1 tr=0 ts=60240013
a=Ip+kZtMD4PYul4iMASbA3A==:117 a=ADWkfsjt5WoA:10 a=IkcTkHD0fZMA:10
a=ac2Zk7JPEtsA:10 a=gir0-LH0AAAA:8 a=UB1Pi8MQYnOLFEG1qMgA:9 a=QEXdDO2ut3YA:10
a=aLewGyoHDmJ4ULJHWpSz:22
X-Authenticated-Sender: p.w.stephenson@ntlworld.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntlworld.com;
s=meg.feb2017; t=1612972051;
bh=/pCjAwJXlnHsyNMDkydaRC/hdrD1HIXkh0UzuBdwQ94=;
h=Date:From:To:In-Reply-To:References:Subject;
b=lmTWRSPhkxvoMzPe50qAzzwrqtgCa9sh/UtG/VPs+U94gWSEbUN7pndgFAqVL7GXA
5u975wZ3bZ7leOLqGqUieTIm7KSshlU+S943nCZX/MNQGG21nD9ZmRvWjtoFISNS/W
aJtkcYbb2D/8yxATH+X3XvV93aTPNSW3D1sRrHstaRuPECLuuMzxeXprplMHcRPiLE
w3UPA332YY0STm6/JcGuvdspdCS87Kzz+5TTcwINlBNAhs1R6Y8cvuniBg9O8NKWKc
H7jB46QeqNtQH79m2CHCeGCpAd5aOlLx7yAwLGBxeXYjPGA80SsSBrOiNF/4AVrs/8
4RHZ3gMuqsdRA==
Date: Wed, 10 Feb 2021 15:47:31 +0000 (GMT)
From: Peter Stephenson
To: Ray Andrews , zsh-users@zsh.org
Message-ID: <752329601.3729797.1612972051119@mail2.virginmedia.com>
In-Reply-To:
References:
<52D5DA56-397F-40BB-BBA7-CE3BF7256581@larryv.me>
<29a203d5-bf53-9cb7-7a49-2705c3b1d8f2@eastlink.ca>
<87a6sc3d0c.fsf@lwm.klanderman.net>
Subject: Re: protect spaces and/or globs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Priority: 3
Importance: Medium
X-Mailer: Open-Xchange Mailer v7.8.4-Rev72
X-Originating-IP: 147.161.167.116
X-Originating-Client: open-xchange-appsuite
X-CMAE-Envelope: MS4xfNL3ZRrBT5+X73qFBcKmaFsp0KCMgjWZHWmcYX8jWVq2r/HPflqSmwdP0MtlG/x+BOoA0+tpWLuHqha6WL41BLdhGkNcbb3RqnQhyqwBr/zHxByRsbLD
2HdmtaSSeyB8P/awgHc8MQnfh//ujM7PEuyGkLL9l5rYZwdA/GVwNcYGYkOF7Et4YicGeQBb6A/uQGj0JIWL8SfnusN+Juniz03VBkAH7Cht77L8cMutxR5b
VkA+gpyF6MgELAHxhs3W4A==
X-Seq: 26493
Archived-At:
X-Loop: zsh-users@zsh.org
Errors-To: zsh-users-owner@zsh.org
Precedence: list
Precedence: bulk
Sender: zsh-users-request@zsh.org
X-no-archive: yes
List-Id:
List-Help:
List-Subscribe:
List-Unsubscribe:
List-Post:
List-Owner:
List-Archive:
Archived-At:
> On 10 February 2021 at 15:18 Ray Andrews wrote:
> =C2=A0 sstring=3D"grep --color=3Dalways -i -- ${grepargs[@]}"=C2=A0 # I =
need to save=20
> to a scalar ...
> =C2=A0 print -rS "$sstring"=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=
=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=
=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # Write to=20
> history ...
> =C2=A0 eval "$sstring"=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=
=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=
=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 # And 'eval'.
Don't turn it into a string here.
fullargs=3D(grep --color=3Dalways -i -- "${grepargs[@]}")
print -rS "$fullargs"
"${fullargs[@]}"
No eval needed, the arguments are now exactly the correct command arguments=
.
Actually, the
"${stuff[@]}"
is only needed to preserve empty arguments. It's a good habit to get into,
but you can think about it more simply as just
$stuff
i.e. a set of array elements that turn into a set of command arguments.
pws