-->

Problem in setting path for android sdk in ubuntu

2019-06-11 17:14发布

问题:

 export PATH=${/home/mohit/}:<android-sdk-linux_86>/tools

this is what i am using..

error:--

bash: PATH=${/home/mohit/}:: bad substitution

this is the path of sdk

mohit@mohit-laptop:~/android-sdk-linux_86$ pwd
/home/mohit/android-sdk-linux_86

回答1:

Typically you will use

export PATH=${PATH}:<added path here>

try that, to append to your $PATH variable, or just remove the ${} and set it directly, if you wish to replace it. Also keep in mind, this change is not permanent unless you add this to your .bashrc or .bash_profile or equivalent scripts. You can reload them with the

source .bash_profile

command without having to re-login.



回答2:

The problem is that ${/home/mohit/} is actually treating /home/mohit/ as a variable and attempting to dereference it. My guess is that what you really wanted to do was:

export PATH="$PATH":"$HOME/android-sdk-linux_86/tools"


回答3:

You can edit your /etc/profile to add the path you need. Like this:

JAVA_HOME=/opt/jdk1.6.0_30
CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export JAVA_HOME
export CLASSPATH
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

It is global.



回答4:

You can maintain a script file under /etc/profile.d/ and we can use it as global