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.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 11637 invoked from network); 3 Apr 2023 12:14:08 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Apr 2023 12:14:08 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1680524048; b=NZK7cFeOJLs+L7jHBhd7GLKzc4mUH22cFjPLecNV4j+dMI6vwUq+sJG7MGM3HE8o5KWRpnfA4K 8cn8DD6qVkTNWL6frBFDQM/ve1BYRigG6+zWCf4N4UZjG5xQ7f5MD+MeKD+YeALvg2hNMRPiLt LGYDJUS5o5RBBvSDkHq7oKDScKjS+dMJlMNiKhsg4F/gehuU8fPQGNbBBc6oRKi/DNTmDUV/oZ ieaBoRHGNivjjt02EipYYbNacSNwRCvhmqeYzBohPAIahrlnRvFv/imHHp8u7lHU5bBaqR+VAc p5tG6k9l8ZoCbq0QgR2uE5Sd2JetMGS/Fy+Z5sJXzy9pBQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd00013-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.13; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1680524048; bh=bIsOXTWg3CF0WY/GmwsGiQPVKaHDB12GBNm7ThZyvsw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:In-Reply-To:To:References:Date:Subject: MIME-Version:Content-Transfer-Encoding:Content-Type:From:DKIM-Signature; b=QHixxR9+1svjKutTeCfbDOlR6R9XXGCApxbtJfl8CPp2odpDr+nOw+Bj10PEKDXB2MUqXkMidU SYAkPlsUAsXBKNi1Kg2fhZN70EV1ph6ra7FUzN6IKPa2xtk0ycV359Cj1RXwtr4U3AwAVu9yCX kcRAajS0u+K7tCrgx0aU92sRQaLJip6qHQV8nHptdf6SM6wDGEP6Pfm6em5B2Ku15N8yP6yym3 /P1zgHlsqkh8DoIg4BpRp9yLB951BXGuYHuEQlfqFqyolsiwh+tdfOUWPZjtRiYlZDLRlCkhth qNUjI7JY3W8qX/IPeiGfGOZdQz9DmfbpPquICu1rn3ngMw==; 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:Message-Id:In-Reply-To:To:References: Date:Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Z+zONyLIz5YnHnKuam9KbWkvfLqlwIYTjr1Nf2gBW7E=; b=LoAL/JFgZBKbIq5CAEOUVl9pyp 6l8upov05SkpnSAJkhWhk2qjrvbAk70vBqxJHI/s/5o7bpHismwdhSxXyzz84HJRdY/838oWsuxP7 +eMzFALpP/Dj90LDVnQjldFIVSZHOJAKNma/pEKM0i7TnIPs58WmF9GK9jK/B2IY7JLmibB40iHZN shShToEH6frIsOrYPomYG88ECWnRFXLBO0q6Epf3JC4DFaeHQfdfIWAIXXs3+izZIeEm1MR6dp12V ozL1VitnUNx5MIaewv7rIwHfJfbTpOhm6UqxDtn8TS7AKPUI4qrLZv7UcbVgHhYvZqtqhZWrDfAw7 8nJ3fIbA==; Received: by zero.zsh.org with local id 1pjJ4a-000GnP-7G; Mon, 03 Apr 2023 12:14:08 +0000 Authentication-Results: zsh.org; iprev=pass (snd00013-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.13; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd00013-bg.im.kddi.ne.jp ([27.86.113.13]:51361 helo=dfmta0011.biglobe.ne.jp) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pjJ4H-000GUe-RW; Mon, 03 Apr 2023 12:13:50 +0000 Received: from mail.biglobe.ne.jp by omta0011.biglobe.ne.jp with ESMTP id <20230403121343944.TNZQ.12048.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Mon, 3 Apr 2023 21:13:43 +0900 From: "Jun. T" Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.2\)) Subject: Re: ksh compatibility: initial value of $_ Date: Mon, 3 Apr 2023 21:13:43 +0900 References: To: zsh-workers@zsh.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3696.120.41.1.2) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 51620 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: > 2023/03/31 17:18, I wrote: > > But, suppose we have a ksh script 'foo' in the current directory: > > % cat foo > #!/usr/bin/ksh > echo $_ > % ./foo > /home/takimoto/tmp/./foo > % ksh ./foo > /usr/bin/ksh Both ksh and bash behave this way, but I personally feel that getting the script name /path/to/foo for both cases is more natural and useful. There may be a situation where a script wants to know the pathname of itself, but for almost always it would not be necessary to distinguish the above two cases. But probably compatibility with other shells would be more important? Then guessing executable/script name only if $_ does not exist in environment would be the way to go.