[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 17:07:04 +0100 |
On Sun, Oct 31, 2021 at 05:23:03PM +0200, Oğuz wrote:
> 31 Ekim 2021 Pazar tarihinde Mike Jonkmans <bashbug@jonkmans.nl> yazdı:
> >
> > Using the hash as alias for commands, that are not in your PATH,
> > seems risky though.
>
> Why? Risky how?
Risky, mostly on a cognitive level.
'command -p foo' doesn't look like it has a side effect.
E.g. assume you have /usr/local/bin/foo and /bin/foo
PATH=/usr/local/bin
command -p foo
foo
You would not think that /bin/foo is executed for foo, given the value of PATH.
It could also lead to bugs.
E.g.
PATH=/usr/local/bin
source script
foo
When the 'command -p foo' is introduced in the sourced script, foo changes.
--
Regards, Mike Jonkmans
- hash not restored after running command -p, Roger Morris, 2021/10/29
- Re: hash not restored after running command -p, Chet Ramey, 2021/10/30
- Re: hash not restored after running command -p, Mike Jonkmans, 2021/10/31
- Re: hash not restored after running command -p, Oğuz, 2021/10/31
- Re: hash not restored after running command -p, Mike Jonkmans, 2021/10/31
- Re: hash not restored after running command -p, Oğuz, 2021/10/31
- Re: hash not restored after running command -p,
Mike Jonkmans <=
- Re: hash not restored after running command -p, Oğuz, 2021/10/31
- Re: hash not restored after running command -p, Mike Jonkmans, 2021/10/31
Re: hash not restored after running command -p, Roger Morris, 2021/10/31