On Sun, Oct 31, 2021 at 05:23:03PM +0200, Oğuz wrote:
> 31 Ekim 2021 Pazar tarihinde Mike Jonkmans <bash...@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

Reply via email to