[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hash not restored after running command -p

From: Mike Jonkmans
Subject: Re: hash not restored after running command -p
Date: Sun, 31 Oct 2021 15:47:59 +0100

On Sun, Oct 31, 2021 at 03:33:07PM +0300, Oğuz wrote:
> On Sun, Oct 31, 2021 at 2:15 PM Mike Jonkmans <bashbug@jonkmans.nl> wrote:
> >         PATH=/dev/null
> >         command -p hostname
> >         hostname # executes /bin/hostname via the hash table
> >
> > I agree with OP that the behaviour is a bug, or at least unwanted behaviour.
> I'd say it's a feature, and a good one too. Not having to prefix each
> invocation of a utility with `command -p ' is a convenience if there's
> a lot of them.

It might indeed be convenient.
Using the hash as alias for commands, that are not in your PATH,
seems risky though.

> > I could not find this in POSIX nor in the bash manual, but it seems true:
> >         Assignment to PATH clears the hash table.
> >         (Even when the value stays the same).
> It's in XCU

Oops, missed that. Thanks.

It is indeed there, under 1.e.i in

Regards, Mike Jonkmans

reply via email to

[Prev in Thread] Current Thread [Next in Thread]