From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 69cefcae for ; Sat, 26 Jan 2019 18:38:51 +0000 (UTC) Received: (qmail 21454 invoked by alias); 26 Jan 2019 18:38:38 -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: 23849 Received: (qmail 17512 invoked by uid 1010); 26 Jan 2019 18:38:38 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f68.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(209.85.166.68):SA:0(-1.9/5.0):. Processed in 2.198012 secs); 26 Jan 2019 18:38:38 -0000 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=3uHTNN0Q73MaJvyCd7VFmoX0L7hE7+rP1DukFG9EHRc=; b=Y/j+iUBq1nKfKKbZWNgqHSWjX7vUhE8MeZF2gDkWfBQpwHOPq7np1+WBzL38mwLCqr lRpxZIXzOZE2nALfKImWtJ0GRPIhSmUqgvCiPBLt9BtupqfTqNJN39c+BiqWlxU7pTki uspbfZ9KjEYZo1utUzG2f8OIomiRWbzUMg+s3W0/4WFdIFhCoOJ5UslRj6wjrdphjE3Z 1sQBSL8Kb/6HkoTqSZk5KK4cGZq7Q7USl11XaGfU1jB6p6MrjUTaxGZ5HTRY29/5zRC6 a5e4M/+U4skkYDyR1RHenrq2y/M+2ujVd/UN6jODQe0RW6vRXfc8WoPeBvM8v2cvfkhF Xlig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=3uHTNN0Q73MaJvyCd7VFmoX0L7hE7+rP1DukFG9EHRc=; b=oPJE7sD4tKhCgpAGkGSaiedAeIdFjBbmZUCMERoasXbPoqTNLWcJnynZYDlKaWxpKN Ej/fLmDpEITVJ4n8c6P4235GNwwy1pEVMpjkbteJCboZ8hweUFV1d9uX/iMOsi1Rzp8U USG3TW6VuoTaCjruP8B+RKVy5tk6fVsmACMTr91hKoEfR77YfU5lGi9796mdswf3Wy6r uSylUa/pfP1Tp3xu+S+3qEogaQkwwFXXxKg3EGyI8A2+cxOecx73qaq/67MbW2nXxIpO 7LUW6iXFF9Kboqc+h9EVCvrHQ5jbxIthYfK5SVcA87K57O5bn+tEiq7/sL+GNDuDLaeZ IaJg== X-Gm-Message-State: AHQUAuaeDRpP3dw18uzaTvQOcRoAt/LRYx3pi+Que5tSell7Eq8QmAIA RnaCzV1bCH+mY1dnd5DPrcXV+guir4s= X-Google-Smtp-Source: ALg8bN7s8530/mcKgh3W/zZ4uQZ6FCo/EN99yxn1A/RYmqlT3dPw9h75CNdkvUsA8t1ufgm3Abu3AA== X-Received: by 2002:a6b:6d15:: with SMTP id a21mr9126597iod.92.1548527913794; Sat, 26 Jan 2019 10:38:33 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\)) Subject: Re: Using script to find location of global rcs files. From: dana In-Reply-To: Date: Sat, 26 Jan 2019 12:38:32 -0600 Cc: zsh , linuxtechguy@gmail.com Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Peter Stephenson X-Mailer: Apple Mail (2.3445.100.39) On 26 Jan 2019, at 12:10, Peter Stephenson = wrote: >No, I'm afraid I can't see a better way --- the value is baked into the >shell but without exposing the value at the shell language level I was also going to point out that zsh itself doesn't even know anything = about the 'etcdir' configure variable =E2=80=94 the configure script uses that = to build the default paths for the global rc files, all of which can be overridden independently, and only those complete file paths are used by zsh = itself. So you can't actually trust that there's just one directory that all of = them live in =E2=80=94 though i assume that's usually the case in practice. *If* you're OK with making the following assumptions... * the files *do* all live in the same directory * at least one of the files exists on the system * the zsh in your PATH is the shell you're actually running (zsh itself doesn't provide a reliable way to find the path to the running shell = binary; in some cases $ZSH_ARGZERO works well enough, but not in a script) ... then i guess you could do this? etcdir=3D${${${(f)"$( ZDOTDIR=3D/dev/null zsh --source-trace -ilnpc : = 2>&1 )"}[1]#+}:h} It's not great though dana