Search code examples
windowsbashcygwin

Local .bashrc is not read on startup under MobaXterm Home on Windows


I am using MobaXTerm (Home version 3.0). I have create a direcorty C:\MobaXterm_3.0\home and set in the local configuration (Settings --> Configuration) the home directory to this path. Under this path I have created a .bashrc file with read access for everybody.

However when starting up MobaXterm, the .bashrc file does not get executed. How can I fix this? The MobaXterm docu says that in the Home addition I cannot change the /etc/profile, but the standard /etc/profile does execute ~/.bashrc. So I am a bit at a loss.

ps: I am aware of the answer to "How does one define aliases for use within MobaXTerm local bash shell?" and have created the .bashrc file with the right permissions.


Solution

  • When you launch a local terminal in MobaXterm first time .bash_profile is executed which sets up the required configuration for the initial shell command prompt to work. The idea is to source the .bashrc from the .bash_profile.

    if [ -f ~/.bashrc ]; then
       source ~/.bashrc
    fi
    

    Add the above lines to your .bash_profile.

    Source: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html