0

I have installed g++ package on Cygwin. so I see the following output in Cygwin:

Input:$ which g++
Output: /cygdrive/c/mingw-w64/x86_64-6.2.0-posix-seh-rt_v5-rev1/mingw64/bin

I have also installed openssh package on Cygwin and configured an ssh server. However, when I connect remotely to my Cygwin I have the following output:

Input:$ which g++
Output: no g++ in (/usr/local/bin:/usr/bin:/bin:/cygdrive/c/Program Files (x86)/Common Files/Intel/Shared Libraries/redis ....

How can I resolve the above issue? Is there any specific ./bash_profile file that is loaded in the case of remote ssh to Cygwin? If yes, can I fix the issue by adding the following line to this ./bash_profile:?

export PATH=$PATH:/cygdrive/c/mingw-w64/x86_64-6.2.0-posix-seh-rt_v5-rev1/mingw64/bin
-1

put the change of PATH in your ~/.bashrc
As reported in the code it will be set for

# base-files version 4.1-1

# ~/.bashrc: executed by bash(1) for interactive shells.
  • No: that file is not read when bash is a login shell, only when bash is an interactive non-login shell. And when bash is not a login shell, it shouldn't change environment variables. See unix.stackexchange.com/questions/26047/… – Gilles Jan 13 '17 at 18:51
  • @Gilles The link that you showed says that ~/.bashrc is not read for login shells. However, I changed the PATH in ~/.bashrc and the login bash shell is reading that. I think this is another weird behavior of Cygwin. – Admia Jan 13 '17 at 21:51
  • @Admia You may have a .bash_profile that loads .bashrc. Put the PATH change in .bash_profile. – Gilles Jan 14 '17 at 13:25
  • @Gilles Right. I just checked it and could see that my .bash_profile loads .bashrc. – Admia Jan 14 '17 at 13:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.