Git Bash on Windows - Where to Store and How to Invoke Bash Scripts
Well, you can put it anywhere you want. But for ease of use, you might want to put it in your home directory. To find it, open up Git Bash and type the following:
cd ~pwd
It should return something like /c/Documents and Settings/username
(or /c/Users/username
). In Windows terminology, that it at "C:\Documents and Settings\username" as you would expect.
There are several places you can put your scripts from which they are auto-loaded. You can execute this command to see which location are being loaded on your system, and in which order:
echo $PATH
Place a script in one of the locations (or create it if it doesn't exist yet) and it will be executable. You can also modify the $PATH
variable in your .bashrc
to add a custom location.
It's important to note though that some of the paths, like /bin
or /usr/bin
usually contain system-critical programs and when some script is broken in there you might not be able to start at all. Paths like /c/Users/username
for your user specifically, or /usr/local/bin
for all users, are usually preferred.