Search code examples
windowsgitbashusb-driveportable-applications

Can I install a msys .bashrc file on a usb drive?


I'm using Git-bash (msys) as my command line tool. I would like to have basic commands like:

export PATH=$PATH:/f/ppython275/App/Scripts

run automatically when I start my shell, but I would like it to be completely self contained, i.e. have the .bashrc file on my usb drive. Is this possible. If so where should I put the .bashrc file


Solution

  • The .bashrc must reside in ~ in order for it to be loaded automatically when you start Git-bash.

    There are a couple of options:

    1. Create a symbolic link (using mklink in Windows). This is only supported on NTFS filesystems and I believe it would work across filesystems.

    2. Create a simple .bashrc file in your ~ that sources the file on the USB drive:

      source /path/to/USB/based/bashrc