Tag Info

Hot answers tagged

2

Adding them to ~/.profile (apply to your user) or a /etc/profile.d/*.sh file (apply to the entire system) is the correct way. In order for the change to apply, you have to log out of your system and log back in, as ~/.profile and /etc/profile.d/*.sh are loaded when you login. To 'reload' ~/.profile in a running terminal, you can use source ~/.profile


2

You see: bash: cd: /media/geo/Novo: No such file or directory since you tried to set a variable for the folder "/media/geo/Novo volume/Geo" (with a space) and the error is about only the first part of the path up to the space, you see, that the space is wrongly treated as separator. If you want to use cd $geo yuo could have to include the quotes in ...


2

For me, this is logical: the $PATH is searched from the beginning to the end and the first matching executable will be run. See the following Q&A's on the same topic: Order of files to be executed in linux and how to change it How to correctly add a path to PATH? How does unix search for executable files? So, first found, first used!


1

Adding a variable to /etc/environment did work for me. However I did have to reboot after changing /etc/environment for the change to take effect. Simply closing and re-opening the terminal window was not sufficient.


1

All you need to do is quoting the variable, since it contains a space character. cd "$geo" Quoting variables which might contain spaces is always good practice in shell code.


1

You don't need to use export; the PATH variable is already exported at that point. Anyway, .profile is read when you log in, so what you've done is correct, but opening a new terminal does not count as logging in.


1

As muru said, this is a duplicate question. You can't do it in /etc/environment, but you can create e.g. /etc/profile.d/mypath.sh and give it this contents: export PATH="$PATH:$SCALA_HOME/bin" Reference: EnvironmentVariables


1

You shoud write it in your ~/.bashrc not in your ~/.bach_profile, then it should work


1

As others have said, you may want to edit ~/.bashrc instead. Just want to mention that if you want the modified PATH to be available also in the graphical environment, you should edit ~/.profile rather than ~/.bashrc.


1

I think I read somewhere that sudo does not pass along all environment variables on purpose, since that could be used to introduce root exploits (not unlike the recent bash bugs). Or you may need to use sudo with -E -E, --preserve-env Indicates to the security policy that the user wishes to pre‐ serve their existing environment ...


1

To answer this question well really requires a thorough understanding of GNU autotools, which I don't have: nevertheless I hope these comments will help. The configure script for a particular build is generated from its configure.ac file using autoconf. In turn, configure.ac uses standard macros to test for the presence of specified components. In this ...


1

Stolen from this SO question If you do cd "$geo" I'll bet you get the right result That being said, try doing alias geo="cd /media/geo/OS/Users/Geo" and then just using geo (as a command) to go there.



Only top voted, non community-wiki answers of a minimum length are eligible