In my .bashrc I have the following:

export TOPDIR=/usr/src/kernels/4.18.0-240.15.1.el8_3.x86_64
export KSRC=/usr/src/kernels/4.18.0-240.15.1.el8_3.x86_64
export PATH=$PATH:/usr/src/kernels/4.18.0-240.15.1.el8_3.x86_64/arch/x86/include/uapi/asm/:/usr/src/kernels/4.18.0-240.15.1.el8_3.x86_64/include:/usr/src/kernels/4.18.0-240.15.1.el8_3.x86_64/include/config
export C_INCLUDE_PATH=/usr/src/kernels/4.18.0-240.15.1.el8_3.x86_64/include
export KERNEL_BUILD_PATH=/lib/modules/4.18.0-240.15.1.el8_3.x86_64/build/

But when I do echo $PATHfrom the command-line, I get the following output:

bash-4.4$ echo $PATH

There are two issues here about which I would seek expert opinion from this panel:

  1. The order in which I have entered my paths in my .bashrc as appended values for my PATH variable does not reflect in the command output. I had specified the order in my .bashrc to force the compiler to look for a specific system file in the order of the paths entered.

  2. There is duplication of paths in the output.

I would like to know what is causing these issues and how can I resolve these?

  • Looks like something else is adding extra entries before .bashrc runs. Actually, .bashrc normally isn't run for login shells, only things like subshells. Check for ~/.bash_profile, ~/.bash_login, `~/.profile, and maybe /etc/profile, and see if any of those is doing it. Jul 16 at 3:01
  • @GordonDavisson yes discovered that /etc/profile has a function pathmunge() which modifies the PATH variable resulting in the duplicity
    – Vinod
    Jul 18 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.