zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: zsh-workers@math.gatech.edu
Subject: "Correct"-like behavior for `.' in the PATH
Date: Thu, 18 Sep 1997 09:00:48 -0700	[thread overview]
Message-ID: <970918090048.ZM13299@candle.brasslantern.com> (raw)

I've just been amusing myself by reading a thread about Linux for DOS users
and why not to have `.' in $PATH, and an idea for a feature struck me.

Why not have a shell option that lets zsh search the current directory for
executables, but that issues a prompt before executing them?

Here's how it'd work; call it `correct_dot' for this discussion:

When correct_dot is set, zsh first searches $PATH for the command.  If it
finds the command in the current directory, it remembers that and goes on
searching.  If it also finds it somewhere later, it prompts like this:

zsh: correct '/bin/ls' to './ls' [nyae]?

(Note that the thing NOT in `.' is the default answer.)

If it never finds it anywhere else, it prompts like this:

zsh: correct 'sl' to './sl' [nyae]?

It'd prompt only in the same instances where `correct' and `correctall' now
do so.  If it can't prompt, it would NOT execute commands from the current
directory, but rather behave as if `.' were not in the path at all.  (Or
just fail, I'm not sure which would be better.)

This could of course be generalized to an option that prompts whenever there
are two different path elements match the same command.

An additional option might be one to treat the path as if `.' were at the
end of it even when it isn't there, if and only if correct_dot was also set.
This would allow root to leave `.' out of his PATH, yet still discover that
a command was in the current directory.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


                 reply	other threads:[~1997-09-18 16:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=970918090048.ZM13299@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@math.gatech.edu \
    /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).