Thanks for the reply. Though POSIX may allow this, still the last line of the following example is rather unexpected behavior
$ $ echo echo MY LOCAL tmp/date SCRIPT > tmp/date $ chmod +x tmp/date $ $ PATH=.:/bin $ date Sun 31 Oct 2021 11:59:07 AM EDT $ hash -l builtin hash -p /bin/date date $ cd tmp ; date ; cd .. MY LOCAL tmp/date SCRIPT $ $ PATH=.:/bin $ command -p date Sun 31 Oct 2021 11:59:50 AM EDT $ hash -l builtin hash -p /bin/date date $ cd tmp ; date ; cd .. Sun 31 Oct 2021 12:00:03 PM EDT $ On Sat, Oct 30, 2021 at 1:53 PM Chet Ramey <chet.ra...@case.edu> wrote: > > On 10/29/21 6:06 PM, Roger Morris wrote: > > > Bash Version: 5.0 > > Patch Level: 17 > > Release Status: release > > > > Description: > > I believe there's a bug in bash 4.4 (and still in 5.1) that wasn't > > there in 4.3.30 > > > > When 'command -p' runs, it no longer seems to restore the hash to its > > previous value. > > This came in in mid-2015 as part of a set of fixes to `command -p'. I think > the bash-4.4 and later behavior is correct: just because you're telling > command to use a standard path it doesn't mean it should not act like it > would in any other circumstance. There's nothing in POSIX that contradicts > that. > > -- > ``The lyf so short, the craft so long to lerne.'' - Chaucer > ``Ars longa, vita brevis'' - Hippocrates > Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/