Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ksh compatibility: initial value of $_



On Wed 5 Apr 2023, at 13:16, Jun. T wrote:
> If we add, say ZSH_EXEPATH, then I think just copying _ from envionment is
> enough.

I don't know if/how people are using $_ within the shell, i don't really use
it myself, but if you've got the code in there to make it match ksh/bash
anyway, what's the reason not to do so? Aside from being worried about wasting
I/O on it like i was... but i'm not sure that was a valid concern

On Wed 5 Apr 2023, at 13:16, Jun. T wrote:
> If this is OK, and if ZSH_EXEPATH (or any other name?) would be usefull,

I would personally like to see something like that go in, with or without a
similar change to $_, if it doesn't bother anyone. I've needed the shell's
path a few times in the past, and although it's simple enough to use procfs
where available, i think you have to resort to parsing lsof or whatever to do
it on macOS

As for the name, here's what the equivalent feature is called in other
interpreters:

- bash: $BASH
- Node: process.execPath
- Perl: $^X
- PHP: PHP_BINARY
- Python: sys.executable
- Raku (Perl 6): $*EXECUTABLE
- TCL: [info nameofexecutable]

Maybe ZSH_EXECUTABLE? That kind of matches ZSH_SCRIPT too

dana




Messages sorted by: Reverse Date, Date, Thread, Author