I have a shell script at /etc/profile.d/pg_local.sh. It contains the following contents:

export PATH="$PATH:/usr/local/pgsql/bin"

Its supposed to load that path in the user accounts' $PATH when the system starts up. However, it is not doing that. When I start up system, and try to use one of the binaries at that path, it doesn't work. I am forced to source it:

source /etc/profile.d/pg_local.sh

What might I be doing wrong?

  • Permissions of etc/profile.d/pg_local.sh perhpas sudo chmod a+x etc/profile.d/pg_local.sh
    – Panther
    May 26, 2015 at 2:55
  • I made the suggested change. I'll see what happens on reboot.
    – Donato
    May 26, 2015 at 3:25
  • I will suggest, try, to export the variable in /etc/bash.bashrc file. Since this is a system wide configuration file and is loaded up for non interactive shells. May 26, 2015 at 3:30
  • @bodhi.zazen that did not work. even when making file executable, it still doesn't load at startup.
    – Donato
    May 26, 2015 at 5:28
  • Are you sure the PATH variable is not getting overwritten somewhere else? You can run this to see what's going on: BASH_XTRACEFD=3 PS4='+ $BASH_SOURCE:$LINENO:' bash -xlic '' 3> /tmp/xtrace-output.txt. Then look through /tmp/xtrace-output.txt.
    – geirha
    May 26, 2015 at 7:39


Browse other questions tagged or ask your own question.