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
Admia
  • 292

1 Answers1

-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.
matzeri
  • 961
  • 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 https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path – Gilles 'SO- stop being evil' 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 'SO- stop being evil' 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