help-bash
[Top][All Lists]
Advanced

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

Re: How to override the default executable resolution order of PATH?


From: Andreas Kusalananda Kähäri
Subject: Re: How to override the default executable resolution order of PATH?
Date: Sun, 3 May 2020 00:11:12 +0200

On Sat, May 02, 2020 at 04:48:06PM -0500, Peng Yu wrote:
> Suppose
> 
> 1. dir1 is before dir2 in PATH.
> 2. Most of the executables with the same name should be resolved to
> those in dir1 instead of dir2.
> 3. There are a small fraction of executables with the same name should
> resolve to those in dir2.
> 4. dir1 and dir2 can not be modified.
> 
> Does anybody know the best way to fine control how the executables are
> resolved to? Thanks.
> 
> -- 
> Regards,
> Peng

For the special cases, the commands that should be picked out of dir2
rather than dir1, create shell functions that override their names:

        foo () { command dir2/foo "$@"; }


-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



reply via email to

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