help-bash
[Top][All Lists]
Advanced

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

Re: Getting the default post-initialisation PATH value at runtime


From: Andreas Kusalananda Kähäri
Subject: Re: Getting the default post-initialisation PATH value at runtime
Date: Thu, 31 Mar 2022 17:50:42 +0200

On Thu, Mar 31, 2022 at 08:58:38PM +0800, Hu Jialun wrote:
> Hello,
> 
> I came across this scenerio today: after accidentally setting PATH to
> something incorrect, I wanted to revert it to its default when bash
> started but was unable to find the default value. Of course it is
> possible to open another shell alongside and copy paste, but it just
> does not feel the right way.

If you don't have session where the PATH variable still has the old
value that you can look at and copy, then just restore the file that you
changed from a recent backup.


The closest to any "default value" for PATH that you will be able to
find is the output of

        getconf PATH

This is however unlikely to be what your old PATH value was and it
may even give you a mostly unusable PATH value that does not contain
any binaries from 3rd-party packages etc. (and it will definitely not
contain any private paths).

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

.



reply via email to

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