zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: PATH_DIRS
Date: Wed, 16 Aug 2017 09:22:05 -0700	[thread overview]
Message-ID: <273e7e71-ede6-09e1-88e3-dcfc425e5544@eastlink.ca> (raw)
In-Reply-To: <CAH+w=7b2aRjTcBvdM6nxA2huhrTtMzVnFx7kyKem2HOptOsaQg@mail.gmail.com>

On 15/08/17 10:32 AM, Bart Schaefer wrote:
> On Tue, Aug 15, 2017 at 9:50 AM, Jim <linux.tech.guy@gmail.com> 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.



  reply	other threads:[~2017-08-16 16:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10 21:46 PATH_DIRS Ray Andrews
2017-08-10 22:19 ` PATH_DIRS Bart Schaefer
2017-08-11  5:07   ` PATH_DIRS Ray Andrews
2017-08-11 16:12     ` PATH_DIRS Ray Andrews
2017-08-14  3:20     ` PATH_DIRS Bart Schaefer
2017-08-15  3:53       ` PATH_DIRS Ray Andrews
2017-08-15 16:50         ` PATH_DIRS Jim
2017-08-15 17:32           ` PATH_DIRS Bart Schaefer
2017-08-16 16:22             ` Ray Andrews [this message]
2017-08-20 10:59               ` PATH_DIRS Jim
2017-08-20 16:50                 ` PATH_DIRS Ray Andrews
     [not found]         ` <CA+rB6GL7tv+_tyswyZYFLksy_+oQ4Nk8ZQ9FRDW8h1dfnKdUgw@mail.gmail.com>
2017-08-16 14:45           ` PATH_DIRS Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=273e7e71-ede6-09e1-88e3-dcfc425e5544@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).