From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 26D872BB8A for ; Sat, 16 Mar 2024 10:34:34 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1710581674; b=puYXEnveIgONTZ9mx0IUYhQ01XhRUmHE29vl6mQzLavTvNwmpyYDgxeRsELRYp5F8GHY4pD/YF KcfFJxV1gWwXqHBXtpr200nmv4URNmXjY7hi6mUu9y6VWbTw1WWnt7QKPxY0UV5oVAIe8wvKMq NsQ2W26tKiGxr5pVrgvHJDdRAFv/iJJ1U2eOfwpKqCSErK38d030yTLDf5jPw205VIDgV6FL93 /4zkJVWMwtwLscUFqh8Z74UOMWbnWTXMaUG5seNsarzVQn0Nj7pJie2zPhez1NXh81iq8/BIxZ wX3GOhEPuFQkdXDIH1/LH0n0w6LtUKvY0TiJpYGg5fEOvQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f177.google.com) smtp.remote-ip=209.85.219.177; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1710581674; bh=uVBJusnHAMtuQD6hrDTkIwlAbMiEkzQBJC6Hd8sSYfQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=dAmAVqaRTZOffNKior2Ntyx7i1amdNpARMLu5sKQI3fITTUpltLlDodV6SkIUrruPZkbW4PbAm WNAGX/S//inZuAFIJu7BADd99WOICncByr7qyr7tvM8ZJXsz1SNxQM+Ll5/IlaN0hEcY437LHj UqNOjDLhpAsO6sBYsQ9KULrePglxv+7leVqMCIqLUFfGFdncT++B8xxWvfdSGZStrIoZ9w8U/O w1rEFKhg5zzQzpoZAvWHCncVbAjGHiTQ0t+k42l7rmy+D1bCHKS5aHDt8U3loRel52WFoh4I0i hFl+EhDTmHfvnPmVfwygpv273gMjDsPvZyc7Pp93MlLjYg==; 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:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=1ktYdxNgmoDSm6t1zLju3Kz+KzpKdn6IoHNfQWP819Y=; b=miy+CIZ/K6TpNiPYxJ18iqI6yq LslEAiqjMeQBa8B/O7x0irsElunFdF8WQkwa9+rLzl5EogfSlddzgUkqUDeD26SVXj4A8WcvIO4m9 dkWAT8uDNj8KOqtg04vDvfrl3LeWbpSVqpnWKA9xatoYwVoR341NJS6Upp+l3wDCIE3p79x7oe/7w ilZUMYzwLGAtLkDBRGcyBeVescOEIxQpVtAaiJA+3DUuH2zgnWrXjKhtn2iORZX0AW1eT+VB+1lRu 5B412N+/XxMpUSOLYAodQEDlCNqRWCP/3VLRrWUgQhYo4XG4rxBhihPs4RhdsCPq31z4/+88Zl2ju 5X9UpR9Q==; Received: by zero.zsh.org with local id 1rlQQy-000LiV-Ms; Sat, 16 Mar 2024 09:34:32 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f177.google.com) smtp.remote-ip=209.85.219.177; dkim=pass header.d=gmail.com header.s=20230601 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-yb1-f177.google.com ([209.85.219.177]:51467) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rlQQ6-000Kzo-Lw; Sat, 16 Mar 2024 09:33:40 +0000 Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-dcbc00f6c04so2598779276.3 for ; Sat, 16 Mar 2024 02:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710581617; x=1711186417; darn=zsh.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1ktYdxNgmoDSm6t1zLju3Kz+KzpKdn6IoHNfQWP819Y=; b=SBubI7qO7RpPjeXx+DAcvoI/KC1ycfibQq08P2WoVmv5oeukrXCscl4ugICwCPwy/P fHSce3SiBSM0WcpVbUberMGDR/+ayFc++GL5Q6Lf1VR2NwpmKqjrlYM9R+Uj5tVVYStm 0CniOnDva+gUkolUHdx15SzI0UbXucFk0E7xeeMaX6Hm1yLQzWZFQZnsgyoow7syZhEn gMkc5s4I8AO+OUdINxmO5OdLbwRRv4gNl1g2A5/Nyk7dK8+vYzAQO/HU20TZ5f4kospr +5VjD/vxmpiQFGxjAcd1W1roWmuNHWmFLdynKYA2Jw1CmRiko7qQ15XFFEdfrku/wlKy yDvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710581617; x=1711186417; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1ktYdxNgmoDSm6t1zLju3Kz+KzpKdn6IoHNfQWP819Y=; b=beClrX2Vobs5k3E8YBGxMqUALrx1B77U5qgHOKBzP4BWECzKXUa2jeiCCDReNWzips OZrbV09XvEpnyz9LBu5gTpy/N0VsaNRaYX4YOyrcFSc/kQlmg+j3scxErx+QeMAaA+QG LmZqXKRq5XS8QK19Vby/QKyK69JZjcHwgNy+GLnbmHcwWU0MZmZwgQg73hJTkxCsHboB WK1U3watcLAxnkcOAVQmdBeFkNNwkV289btjnlGlR8zE9Y97SnaZuuLjIW7x9g9IrOdY NHIRJP1oIhsr5e93avFlC+y0AB8xKyfC0aJvNr6MVC7OwHy6k3N+BSFV91vOW54YUmGp tGTA== X-Gm-Message-State: AOJu0YzgxAF3a1ndmXvDhmN1xx5Ctgc19iBRpr/4YSLZVjJ+cicfwW5l gIp1fWSvn7BRRZtlkQv3wKNvolsNMoxeUO3I0QjoC4dWIc3Ncylm/iDLu9vH3+s3QOBchor7302 F51u1xlns/dTf8FW2k4T3icL6mr1AmQjrlD4= X-Google-Smtp-Source: AGHT+IEuAi0zeR/obOcVCrKSfSNbU0j6t8oT3oZvQKNpdryD9Owk6Lnq2DF9zr1leFTNCHwVD+pcnbMoHpAcNNrfdoI= X-Received: by 2002:a25:a2c5:0:b0:dc2:2d0a:4d55 with SMTP id c5-20020a25a2c5000000b00dc22d0a4d55mr3536587ybn.63.1710581617216; Sat, 16 Mar 2024 02:33:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Felipe Contreras Date: Sat, 16 Mar 2024 03:33:25 -0600 Message-ID: Subject: Re: What's the equivalent of ${BASH_SOURCE[0]}? To: Bart Schaefer Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29738 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 Fri, Mar 15, 2024 at 11:07=E2=80=AFPM Bart Schaefer wrote: > > On Fri, Mar 15, 2024 at 9:28=E2=80=AFAM Felipe Contreras > wrote: > > > > I meant the name of the source script file > > Like $ZSH_SCRIPT ? No. Le'ts get the terminology straight from zsh manpages: In describing $0 it says: If the FUNCTION_ARGZERO option is set, $0 is set ... upon entry to a sourced script to the name of the script So when you do "source ./lib.sh" inside that script "./lib.sh" is the name of the sourced script. On the other hand this is the description of $ZSH_SCRIPT: If zsh was invoked to run a script, this is the name of the script So if "lib.sh" is sourced from "foo.sh", then $ZSH_SCRIPT would be "foo.sh", whereas ${BASH_SOURCE[0]} would be "./lib.sh". Both are "names of a script", but one is an "invoked script" and the other is a "sourced script". Correct? I'm looking for the name of the *sourced* script. So it would be something like $ZSH_SOURCE (if it existed). --=20 Felipe Contreras