In /etc/environment
variable expansion is not performed. You cannot define a variable here and then reference it with $
. Your path literally includes "$ANDROID_SDK" which is not expanded into /opt/android-sdk
If you want to define your path in /etc/environment
then use the full paths
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/android-sdk/platform-tools:/opt/android-sdk/tools
(and your full JAVA_HOME path which I don't see in your question.)
Rather than defining your path system-wide, you may want to define it locally (generally preferred).
The local version of /etc/environment
is ~/.pam_environment. This has a slightly different syntax. To set the path here, reference the current path and append your additions like this:
PATH DEFAULT=${PATH}:/opt/android-sdk/platform-tools:/opt/android-sdk/tools
(and your JAVA_HOME path too after another colon)
You also can use ~/.profile
or in ~/.bashrc
- in these files you can use the normal shell syntax with $
expansion like you did before.
After you define it, you then need to source the file by doing source .profile
or whichever file you used, or by logging out and back in. (The exception is .bashrc
which is sourced every time you start an interactive shell, so opening a new terminal would be enough)
ls /opt/android-sdk
. – Andrea Lazzarotto Aug 22 '16 at 19:01