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

Re: PATH_DIRS



On 15/08/17 10:32 AM, Bart Schaefer wrote:
On Tue, Aug 15, 2017 at 9:50 AM, Jim <linux.tech.guy@xxxxxxxxx> wrote:
Nothing, as far as I can tell.  I believe it is your point of view what
PATH_DIRS is doing.  As long as "somescript" is in your PATH,
I don't believe PATH_DIRS is doing much if anything.
Right, I got a bit confused about what Ray was asking
Sometimes even the question contains errors, so thereyago we can't expect mindreading.

At the end of the day all I want is for whence to show me sourcable scripts as well as +x scripts. Since sourcable scripts are found and run according to PATH etiquette (although the current dir is also always searched and we have the PATH_DIR option as well) I want whence to inform me what command will be run if I type it and press enter:

 6 /aWorking/Zsh/Source 2$ whence somescript
[nothing]

6 /aWorking/Zsh/Source 2$ . somescript
this is somescript on the path

... In fact somescript is runable and is found on the path. Now, if it is the case that I want to run it under a subshell and I 'chmod +x somescript', then of course it shows up in a whence search, BUT I might very well simply want to source it and in either case I think whence should find it for me. That is, if the shell will search for it and run it (even as a sourced script) then whence should show it to me IMHO whether I choose to source it or execute it ... which it sorta does if I use '-m'.

And there is this bafflement:

/aWorking/Zsh/Source/Wk $ whence -mav more
more is /aWorking/Zsh/System/more # 'more is a 'chmod +x' script on the path.
more is /bin/more
# output as expected '-a' shows all files found, -' m' does the pattern search giving my script and the binary. But now:

/aWorking/Zsh/Source $ chmod -x aWorking/Zsh/System/somescript

/aWorking/Zsh/Source $ whence more
/bin/more
# Fine, unless I " $ . more " in which case I get something else and the previous command gave the script the prior listing, suggesting it has prior execution, no?

/aWorking/Zsh/Source/Wk $ whence -mv more
more is /aWorking/Zsh/System/more
# OK, my script would be the first thing executed *IF* I sourced it but not if I executed it in which case I get the binary.

3 /aWorking/Zsh/Source/Wk 5$ whence -mav more
more is /bin/more
# Where did my script go? '-a' seems to cancel '-m' here, I expect both '-m' and '-a' to add output, not subtract from it. Basically, it seems intuitive to me that if I make a script I think of it as the same animal, whether I source it or execute it. Dunno, maybe this is really correct and if I understood it better it would seem intuitive but at the moment the fact that sourced scripts are searched for on the path seems to me to give them the same 'rank' as any other runnable thingy and I expect whence to find them as such. I'm not thinking of 'whence -m' as a sort of 'find', I want to see what is going to execute. If the 'more' script is good enough for 'whence -m' then 'whence -am' should show it too. No? But it's complicated, maybe what I think I want would break some other logic. As it is, to get one-stop shopping, my wrapper shows me this:

6 /aWorking/Zsh/Source 2$ i more

Searching the path for text files or scripts that are not '+x':

LISTING: -rw-r--r-- 1 18 2017-08-16/08:16:07 /aWorking/Zsh/System/more
CONTENT: PLAIN   text/plain; charset=us-ascii:

Aliases, functions, builtins, executable scripts/text or binaries: Found 1 matches:

(1)TYPE: more is /bin/more:
LISTING: -rwxr-xr-x 1 39752 2017-03-22/02:43:33 /bin/more*
CONTENT: EXECUTABLE LIBRARY application/x-sharedlib; charset=binary:

... so I know what's actually going on, but it seems to me that whence should give me one-stop shopping too.




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