Bash/cygwin/$PATH: Do I Really Have To Reboot To Alter $PATH?
Solution 1:
Try:
PATH="${PATH}:${PYTHON}"; export PATH
Or:
export PATH="${PATH}:${PYTHON}"
the quotes preserve the spaces and newlines that you don't have in your directory names. I repeat "don't".
If you want to change the path for the current environment and any subsequent processes, use something similar to either of the commands above; they are equivalent.
If you want to change the path for the next time you start Bash, edit ~/.bashrc
and add one of the above (for example) or edit the existing PATH
setting command that you find there.
If you want to affect both the current environment and any subsequent ones (i.e. have an immediate and a "permanent" affect), edit ~/.bashrc
and do one of the following: type one of the first two forms shown above or source the ~/.bashrc
file. Sometimes, you may not want to do the sourcing if, for example, it would undo some temporary thing that you're making use of currently like have some other variables set differently than ~/.bashrc
would set (reset) them to.
I don't think you need to worry about hash unless you're either doing some serious rearranging or adding some local replacements for system utilities perhaps.
Solution 2:
If you want your changes to be permanent, you should modify the proper file (.bashrc in this case) and perform ONE of the following actions:
- Restart the cygwin window
- source .bashrc (This should work, even if is not working for you)
- . .bashrc (that is dot <space> <filename>)
However, .bashrc is used by default when using a BASH shell, so if you are using another shell (csh, ksh, zsh, etc) then your changes will not be reflected by modifying .bashrc.
Solution 3:
A couple of things to try and rule out at least:
Do you get the same behavior as the following from the shell? (Pasted from my cygwin, which works as expected.)
$ echo $PATH /usr/local/bin:/usr/bin:/bin $ export PATH=$PATH:/cygdrive/c/python/bin $ echo $PATH /usr/local/bin:/usr/bin:/bin:/cygdrive/c/python/bin
Is your bashrc setting the PATH in a similar way to the above? (i.e. the second command).
Does your bashrc contain a "source" or "." command anywhere? (Maybe it's sourcing another file which overwrites your PATH variable.)
Solution 4:
You may need to re-initialize bash's hashes after modifying the path variable:
hash -r
Post a Comment for "Bash/cygwin/$PATH: Do I Really Have To Reboot To Alter $PATH?"