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 23851
- From: Jim <linux.tech.guy@xxxxxxxxx>
- To: dana <dana@xxxxxxx>, zsh <zsh-users@xxxxxxx>
- Subject: Re: Using script to find location of global rcs files.
- Date: Sun, 27 Jan 2019 07:11:40 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to; bh=dSOBnRfnpcaBeMBXwSFj9kFXgJj6w400Pe80RqL4nwo=; b=JNMmMk9L9LrcXXLaJ/5w20nGPcWu49Q7C/rVygo1Gxnr2lmVA/Yp1fkJjbrpkj+Q3z xJCjHFjB9/BNTHJMkBTtHJpEnjoj7e2gpH9XxGKJn5KW2R+THAmgMR3WEU83BzoqbTUG V7+k3rgfNgdmDJPBTf/nLPfYI00aLKauyDIFcNs7gKSygnmqIq8Sx6i7nl80+uTR/HXZ urJboclw7vMiju7kYbVnUnwyFFdOjkyjDfJHva1h+vudt7z3YVxsKyww/g/YSE/WCOSt WR4m1uM6CujUB3lL5oPDPM3sv8jQEsM+jqt9ElP54RKD2Xp7SCwGJ7qfDx/mmYDgeEzi 0Xig==
- In-reply-to: <B79CD6E7-D834-4BC0-A8C2-C2D77EC8FA96@dana.is>
- 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> <B79CD6E7-D834-4BC0-A8C2-C2D77EC8FA96@dana.is>
- Reply-to: linuxtechguy@xxxxxxxxx
Thanks. Hadn´t used that combination of options before, but learned
something new. To bad zsh doesn´t have an option to display
the build information, but I leave it to others more qualified to say if
that
is possible or practical.
On Sat, Jan 26, 2019 at 12:38 PM dana <dana@xxxxxxx> wrote:
> 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}
>
Had some trouble with the above line of code when there is only one global
file,
It only returned a ¨.¨. Assuming I typed it correctly.
The following appears to work for one or more global files.
etcdir=${${${(z)${${(f)"$( ZDOTDIR=/dev/null zsh --source-trace -ilnpc :
2>&1 )"}#+}}[1]}:h}
Hopefully no typos here either. Not sure I transitioned correctly between
array
and scalar.
It's not great though
>
> dana
>
Again, thanks.
Jim
Messages sorted by:
Reverse Date,
Date,
Thread,
Author