zsh-users
 help / color / mirror / code / Atom feed
From: Steve Dondley <s@dondley.com>
To: "Lawrence Velázquez" <larryv@zsh.org>
Cc: zsh-users@zsh.org
Subject: Re: Can't tell the difference in operation between PATH_SCRIPT and NO_PATH_SCRIPT
Date: Thu, 25 Jan 2024 22:21:44 -0500	[thread overview]
Message-ID: <680FA5D3-E8FD-49F2-9AE3-C169A6D9DA9E@dondley.com> (raw)
In-Reply-To: <bcfc8d6c-c4f9-402d-86c5-01a0ec503d44@app.fastmail.com>

[-- Attachment #1: Type: text/plain, Size: 1845 bytes --]

Sorry, I’ve got a bad misconcepiton somewhere. I stil don’t get it.

I do: PATH=.dir

When I do: setopt pathscript
And then do: foo.zsh

It finds foo in the ./dir directory and executes it.


Then when i do: unsetopt pathscript
And then I do: foo.zsh

It stil finds foo.zsh in the ./dir directory.

So I’m not seeing how it behaves any differently. 





> On Jan 25, 2024, at 10:05 PM, Lawrence Velázquez <larryv@zsh.org> wrote:
> 
> On Thu, Jan 25, 2024, at 9:00 PM, Steve Dondley wrote:
>> I’ve been looking over the documentation and I really can’t make sense 
>> out of what the PATH_SCRIPT option is supposed to do.
>> 
>> If it’s set, which it is by default, I think it’s supposed to look 
>> through directories PATH and try to find the command. But if it’s not 
>> set, it doesn’t look through directories in PATH.
>> 
>> At least that’s my understanding. But as a far as I can tell, I can run 
>> a command in /bin with or without PATH_SCRIPT option set.
>> 
>> I’m obviously confused about what the docs are saying. Can someone shed 
>> light on this for me?
> 
> The option affects how zsh behaves when invoked without -c or -s
> and with a first non-option argument that doesn't contain any
> slashes.  In this situation, shells generally try to find and run
> a script with that name in the current directory; if there is no
> such script, they try to find one in PATH.  PATH_SCRIPT lets you
> control whether zsh performs that fallback PATH search.  (It does
> not affect other PATH searches.)
> 
> 	% cat foo.zsh
> 	cat: foo.zsh: No such file or directory
> 	% cat dir/foo.zsh
> 	print foo
> 	% PATH=./dir
> 	% /bin/zsh -o PATH_SCRIPT foo.zsh
> 	foo
> 	% /bin/zsh +o PATH_SCRIPT foo.zsh
> 	/bin/zsh: can't open input file: foo.zsh
> 
> -- 
> vq


[-- Attachment #2: Type: text/html, Size: 11291 bytes --]

  reply	other threads:[~2024-01-26  3:25 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26  2:00 Steve Dondley
2024-01-26  3:05 ` Lawrence Velázquez
2024-01-26  3:21   ` Steve Dondley [this message]
2024-01-26  3:30     ` Steve Dondley
2024-01-26  3:45     ` Lawrence Velázquez
2024-01-26  4:17       ` Steve Dondley
2024-01-26  4:58         ` Lawrence Velázquez
2024-01-26  5:20           ` Steve Dondley
2024-01-26  5:52             ` Bart Schaefer
2024-01-26  6:35               ` Lawrence Velázquez
2024-01-26 15:49               ` Steve Dondley
2024-01-26 16:07                 ` Mark J. Reed
2024-01-26 16:41                   ` Mark J. Reed
2024-01-26 17:21                     ` Steve Dondley
2024-01-26 18:28                       ` Ray Andrews
2024-01-26 18:38                         ` Roman Perepelitsa
2024-01-26 19:17                           ` Steve Dondley
2024-01-26 19:38                             ` Roman Perepelitsa
2024-01-26 19:52                               ` Steve Dondley
2024-01-26 20:06                                 ` Ray Andrews
2024-01-26 20:16                                   ` Lawrence Velázquez
2024-01-26 19:54                             ` Ray Andrews
2024-01-26 20:05                               ` Steve Dondley
2024-01-26 20:43                               ` Steve Dondley
2024-01-27  2:34                             ` .m0rph
2024-01-26 19:42                           ` Ray Andrews
2024-01-26 20:08                             ` Roman Perepelitsa
2024-01-26 20:21                               ` Steve Dondley
2024-01-26 20:40                               ` Ray Andrews
2024-01-26  6:25             ` Lawrence Velázquez
2024-01-26  6:42               ` Lawrence Velázquez
2024-01-26 15:27               ` Steve Dondley
2024-01-26  4:35 ` Lawrence Velázquez

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=680FA5D3-E8FD-49F2-9AE3-C169A6D9DA9E@dondley.com \
    --to=s@dondley.com \
    --cc=larryv@zsh.org \
    --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).