Bash – Where is Cygwin set its PATH variable

bashrccygwin;path

If I write echo $PATH in my Cygwin window (mintty) I get a list of paths. That list does not match the Windows Envirnonement variables list. I cannot find a file, where is the variable $PATH set. None of the ~/.* files like .bashrc, .bash_profile, .profile, .inputrc, .minttyrc contain $PATH setting.
So, where is the variable $PATH actually set?

Best Answer

For bash the PATH is set initially in /etc/profile

  # Setup some default paths. Note that this order will allow user installed
  # software to override 'system' software.
  # Modifying these default path settings can be done in different ways.
  # To learn more about startup files, refer to your shell's man page.

  : ${ORIGINAL_PATH=${PATH}}
  if [ ${CYGWIN_NOWINPATH-addwinpath} = "addwinpath" ] ; then
    PATH="/usr/local/bin:/usr/bin${PATH:+:${PATH}}"
  else
    PATH="/usr/local/bin:/usr/bin"
  fi

By default it includes the Windows PATH

If you need to modify it the best place are .bash_profile and .bashrc

Related Question