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 wrote: > 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 — 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