Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Using script to find location of global rcs files.
- X-seq: zsh-users 23849
- From: dana <dana@xxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: Using script to find location of global rcs files.
- Date: Sat, 26 Jan 2019 12:38:32 -0600
- Cc: zsh <zsh-users@xxxxxxx>, linuxtechguy@xxxxxxxxx
- 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==
- In-reply-to: <f13f8a7bce03b94b0a3cce202548b952c61241e8.camel@ntlworld.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CA+rB6GJBTN_BzedW=CvpxFHXMMZyuQWTU04dEEZVNwJvrxG2wA@mail.gmail.com> <f13f8a7bce03b94b0a3cce202548b952c61241e8.camel@ntlworld.com>
On 26 Jan 2019, at 12:10, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> 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 — 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 — 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=${${${(f)"$( ZDOTDIR=/dev/null zsh --source-trace -ilnpc : 2>&1 )"}[1]#+}:h}
It's not great though
dana
Messages sorted by:
Reverse Date,
Date,
Thread,
Author