Super User Asked on November 14, 2021
I have noticed that my MSYS bash doesn’t "know" about the environment variables defined on my system. This means that if the folder C:MyStuffbin
is in my path, and that folder contains mycommand.exe
, then running mycommand
in the MSYS terminal will return an error indicating that it could not be found.
How do I cleanly "integrate" MSYS with the rest of my system? Is that something to be avoided?
I use Cygwin
(which is similar to msys
in the way it works) and selectively add parts of my Windows PATH to my bash PATH as follows:
I have a file (.path_elements
) containing the directories I want in my bash path:
/home/DavidPostill/bin:
/usr/local/bin:
/usr/bin:
/c/Windows/system32:
/c/Windows
Note: if you add lines to your .path_elements
file they must be terminated by :
(except for the last line).
I modified my .bash.profile
file as follows:
#DCP 20151019 comment out the original code for setting PATH
# Set PATH so it includes user's private bin if it exists
# if [ -d "${HOME}/bin" ] ; then
# PATH="${HOME}/bin:${PATH}"
# fi
#DCP 20151019
# Build up the path using the directories in ~/.path_elements
unset PATH
while read line; do
PATH="${PATH}$line";
done < ~/.path_elements
...
#DCP 20151019
# Add current directory to path
export PATH=".:${PATH}"
Now in my bash
shell:
$ echo $PATH
.:/home/DavidPostill/bin:/usr/local/bin:/usr/bin:/c/Windows/system32:/c/Windows
$
You should be able to do something very similar in msys
.
Answered by DavidPostill on November 14, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP