Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

executing a custom init script for bash --login -i for example to change to a custom directory from a shortcut

Tags:

bash

Right now I'm using MSysGit on Windows 7, which is started from a .bat file, which itself calls bash.exe --login -i to start a shell. At which point it executes the .bashrc file (among others) in the user's home directory. I use this script to setup the environment and cd to a starting directory.

This all works fine. What I would like is to change the .bat file in some way so that bash will execute a custom script at startup so that in that script i could perform a different initialization and cd to a different starting directory. Then I could have two separate .bat files calling each script, then I could make a shortcut to both on the desktop and start whichever I want.

The thing that I'm not sure how to do, is get bash to run a custom init script on startup. Currently the command MSysGit uses is bash.exe --login -i. Is there any way I can modify this to get it to use a custom file? I tried bash.exe --login --rcfile 01.txt -i but that didn't work. Likewise nothing else I tried worked either.

like image 673
Coder Avatar asked Nov 05 '22 01:11

Coder


1 Answers

Try it without --login:

bash.exe --rcfile 01.txt -i
like image 189
Dennis Williamson Avatar answered Nov 09 '22 08:11

Dennis Williamson