From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5437 invoked from network); 18 Sep 1997 16:07:02 -0000 Received: from math.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 18 Sep 1997 16:07:02 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id MAA09552; Thu, 18 Sep 1997 12:00:34 -0400 (EDT) Resent-Date: Thu, 18 Sep 1997 12:00:34 -0400 (EDT) From: "Bart Schaefer" Message-Id: <970918090048.ZM13299@candle.brasslantern.com> Date: Thu, 18 Sep 1997 09:00:48 -0700 X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-workers@math.gatech.edu Subject: "Correct"-like behavior for `.' in the PATH MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"ncduz.0.8L2.X0L8q"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3508 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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