Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-01-04 Thread Matthew Woehlke
Bojan Land wrote: Under what circumstances does the gnu-bash path hash differ from that of the $PATH variable? Why is it even possible for this difference to occur? Because bash uses a hash to speed look-up of frequently used commands. The only way to (almost) always get the right command eve

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-01-04 Thread Matthew Woehlke
Bob Proulx wrote: Bojan Land wrote: Do you know which shells do not have type and thus rely on which? I wouldn't guess that *any* shell "relies" on 'which'... probably all shells have built-in $PATH lookup, but may not expose it to the user in the way bash's 'type' does. As far as I know

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-01-04 Thread Bob Proulx
Matthew Woehlke wrote: > Bob Proulx wrote: > > Traditional Unix machines used a csh script /usr/bin/which to search a > > defined set of system paths. Newer ksh used 'whence'. Bash uses 'type'. > > XSI extensions to POSIX require 'command -v'. Debian implemented > > 'which' as a bash shell scrip

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-01-04 Thread Matthew Woehlke
Bob Proulx wrote: Matthew Woehlke wrote: $ which --version GNU which v2.16, Copyright (C) 1999 - 2003 Carlo Wood. Wonderful. Yet another 'which' implementation! But a consistent (when available) one. :-) I like GNU programs because they are usually portable; for example I have built GNU 'w

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-01-04 Thread Bojan Land
On Wed, 2007-01-03 at 22:55 -0700, Bob Proulx wrote: > > I have learned a lot from your reply, and yes some of what you wrote > > explains this as not being a bug; after a reboot I cannot reproduce > > these results. > > You should not need to reboot to clear a single shell process hash > cache.

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-01-04 Thread Bob Proulx
Bojan Land wrote: > Bob Proulx wrote: > > This is possible when it has been cached by bash and then the > > executable is either moved from its original location or a new > > executable appears earlier in PATH. > > I did not move the executable. Right. "or a new executable appears earlier in PAT

Re: GNU bash, 3.00.15(1)-release, referenced cmd in cwd executes alternate cmd

2007-01-04 Thread Matthew Woehlke
Bojan Land wrote: If I just use 'type mycmd' the result is similar in that it simply prepends the query before the result with " is " inbetween; -p prevents this additional processing and output? No. According to 'help type', "If the -p flag is used, `type' either returns the name of the disk