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 autolearn=ham
autolearn_force=no version=3.4.4
Received: (qmail 23303 invoked from network); 25 Oct 2022 16:09:11 -0000
Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368)
by inbox.vuxu.org with ESMTPUTF8; 25 Oct 2022 16:09:11 -0000
ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1666714151;
b=UeDlfp383S1sn/XuEGRyN8MZnpt+tX3Itkzp34uLPoQY/ZOGHyBLzpri2qPWnkopf79ZXk487Y
VG2gwn24TeOWdDl4iG5pUGTjyUf/BQ4n3mlZ67xrTWt0KNCwfSjxZMGFusVK+p+3h1+eB1udjq
mNvfOOKEpmK/PxrM+Hj4MLQIgEUbiA+PfQjUKpdd0ixRaAxWkPQdhCKlfVa+vJLxWV/75C7wv2
WhmyhY+NqWsjITM/J2Wysy+jo/98v96r2woGFf5KeZD3wmDYkLapvmGoPRMN/+VHMGqdnlowgA
JQE2XQ+COR3qaSl9weW+7lhBZXZ/bRfGdfd+CXux3zY+dA==;
ARC-Authentication-Results: i=1; zsh.org;
iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97;
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-20210803; t=1666714151;
bh=DhcAkFZy/gIRKLYU+zPiQtvu0csrhh6+GR/X6FMsWzs=;
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=rBHrOaxYrc5BS+Xp7TRE+O2sSolQ1HkoIk3KU85K+qvC1btf5kfPcqFaPJVYGISdItdn6ElG3+
cdNCHzKNQxxksyQCHcfFnOQlTOSC0/VJ0fh6d1l4ra7O2tvjQgiP1IuXNsa8ie2qhhQRzS071i
n8ziEe/lsnzvEFBumOjRYPchj1BxPgSl+WvOy1h3Fr9B+v6sfNz+amX8USCGXvwXNUHjVv8dQw
TVvwh/Mu3D5Tpd7PxulFpXkJVlJedQOutA3qDx8+ERQBt3b9NA0R5K7ceT8IXR4UlUncsnvmOO
LIsDwIPvLsEb2kCLYVrHIc1NwJCskoyij05q/mAHGK6kKQ==;
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org;
s=rsa-20210803; 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=nx8ryzzUksGZuZYzUNO/zPTyt9cqSXhdZczVT5Vjb64=; b=F/cUxN6LdaDNB14Ad3nwZzIW7J
cI7pQAKRDlR82e1lWuQxv6aTQ/MPDmmEyHPd+PK+9+qCfXSxaZBlCKhW0efDmGwx2y1WZWSt5jXIK
HEJwwEqBbS/ncbY0h2ZI5N8tR1jWfatiz/rz96jqJkSb8S83Jbwi9ALd8tU7yAWusWMu8W/S/e4ny
944+o2f/jPUFKYJA8PRO8t1Q+PUkxJgzBhjdT8Va3iFsHxbTJFmPUJ8HxUKmfkJzFF1DEwlQEw6fZ
uIgRAZ+mDZPSgVt0zNBpQRp3JWaubh0vF6Ph8FX/Gnng+GkyCn+R0JNKSsPiuktjJVqIx9A/Ub2lx
tKWigbYA==;
Received: by zero.zsh.org with local
id 1onMUJ-000OmP-BY;
Tue, 25 Oct 2022 16:09:11 +0000
Authentication-Results: zsh.org;
iprev=pass (smtpq2.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.97;
dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256;
dmarc=pass header.from=ntlworld.com;
arc=none
Received: from smtpq2.tb.ukmail.iss.as9143.net ([212.54.57.97]:39090)
by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256)
id 1onMTO-000O5X-8P;
Tue, 25 Oct 2022 16:08:14 +0000
Received: from [212.54.57.82] (helo=smtp3.tb.ukmail.iss.as9143.net)
by smtpq2.tb.ukmail.iss.as9143.net with esmtp (Exim 4.90_1)
(envelope-from
)
id 1onMTN-0005D2-Tg
for zsh-users@zsh.org; Tue, 25 Oct 2022 18:08:14 +0200
Received: from oxbe15.tb.ukmail.iss.as9143.net ([172.25.160.146])
by smtp3.tb.ukmail.iss.as9143.net with ESMTP
id nMTNoD49FsyQZnMTNor5gz; Tue, 25 Oct 2022 18:08:13 +0200
X-Env-Mailfrom: p.w.stephenson@ntlworld.com
X-Env-Rcptto: zsh-users@zsh.org
X-SourceIP: 172.25.160.146
X-CNFS-Analysis: v=2.4 cv=W/8r6Dak c=1 sm=1 tr=0 ts=635809ed cx=a_exe
a=3VDdwIuOneLoWcGUQKPbfw==:117 a=1DWFKdCB1IcA:10 a=IkcTkHD0fZMA:10
a=ZjyAdWuDOD4A:10 a=gir0-LH0AAAA:8 a=ZNjq22PwDiGDxuIocn4A: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=1666714093;
bh=DhcAkFZy/gIRKLYU+zPiQtvu0csrhh6+GR/X6FMsWzs=;
h=Date:From:To:In-Reply-To:References:Subject;
b=M5lWBl4POMKsN0Hy4kjrr+r+wRRKZEv6AIpkXLSWCW99oZWOviGchtOSiRZQHx+Lz
irsFQ1h+o1A555P655w/OmsfY1wFoBjF+wwO5LqQvjoGeDKUY/67wNAiXSADsFrcAj
TnREMl7yzNkkkC8Z3m1MXNnMYYryYdUuZ8/o+qYhoqZNfVTHYDUAGCnOHrV4Vtt+nY
pvxzMGD8gYhoIDt74jhHrPOq/O0rdoK5dyPtMel/EQOrTZp0jRahqcLJhG9MvDNn4A
e69EOwzEBqcJPmas/HCM2o37Xf9ZfH/zV5q4CWLVtdXMJd0PaCaqZFaQn8SjqOmstZ
9oAqZqh0Wbupg==
Date: Tue, 25 Oct 2022 17:08:13 +0100 (BST)
From: Peter Stephenson
To: Ray Andrews , Zsh Users
Message-ID: <54517317.3641240.1666714093628@mail.virginmedia.com>
In-Reply-To: <04b0ce6b-be24-66f0-44e6-0183280e19cf@eastlink.ca>
References: <04b0ce6b-be24-66f0-44e6-0183280e19cf@eastlink.ca>
Subject: Re: priority of execution
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Priority: 3
Importance: Normal
X-Mailer: Open-Xchange Mailer
X-Originating-IP: 147.161.224.167
X-Originating-Client: open-xchange-appsuite
X-CMAE-Envelope: MS4xfCs4X7lxwTll4OZlh3JPsqDDyTnqRWM/UAd2SesPvob/up1yHVWG3eSwpyNOf92G6z7TSVfS5tTNxzT+I7QzxKn9q3kY9MPWfI3vr93M4Qo67hhIirlD
kti15ER9cHQIsUgkqBxDPZ0BdkFLnKSe95WavWvvGMz+YwGreE7SKhbRh27vsarsiIz2fKf2TV4b8XYlSbbqQkPsraaK0wCTGta1PVfyBdicfjARM9UUfhe0
WbLE/0/fnMW9U42He0EsMA==
X-Seq: 28267
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:
> On 25/10/2022 16:47 Ray Andrews wrote:
>
>
> So far I'm aware of these categories of actionable entities:
>
> alias, autoload, builtin, function, executable script, binary.
The different categories known to whence, from looking at the source,
are aliases, reserved words, shell functions, builtins, and binaries
in the file system (in the case of whence, those found via $PATH).
Autoloadable functions are a special category of function --- the
difference only comes into play once the shell has decided it's
looking for a shell function, so it's hidden from top-level
execution.
The same goes for shell scripts as a special category of
binaries found in the file system. The shell sees the script is
a binary in the path and tries to execute it just like anything
else marked as executable. Typically the OS knows how to deal
specially with scripts, though the shell has this knowledge as
a fallback.
> $ whence -av declare
> declare is a reserved word
> declare is a shell builtin
Reserved words are different from builtins in that they have special
syntax --- the shell knows, for example, that "if" isn't just a command
with arguments, it's got to do a lot more work to handle it. In
principle, if you turned it off, the shell *could* have an "if"
builtin as well. That would obviously be stupid.
You've actually hit a special case here where it's not stupid.
This dates from when declare and its relatives were extended to
handle arrays,
declare array=(bray cray dray)
That needs special parsing because the elements of the array have
to be treated as separate words.
The thing about reserved words is the shell has to be able to see
them in time to parse them. But the following is perfectly valid
syntax, because "declare" can be used as a normal command:
cmd=declare
$cmd var1 var2 var3
The shell sees $cmd and treats it as the start of a normal command
line for expanding later. By that time it's already parsed the
arguments as a normal command. Instead, it just treats "declare"
here as a normal command with arguments. That's why you see it
show up as a shell builtin as well as a reserved word.
That second case is rather special; you wouldn't encounter it very
often. But people moan horribly if we break their special cases.
pws