Reputation: 71
I want to set an environment variable that has space in it. it is a path to a folder and the folder name is:
/Applications/Android Studio.app/Contents/gradle/gradle-2.10
I edit .bash_profile
and add the following line to it:
export GRADLE_HOME=/Applications/Android Studio.app/Contents/gradle/gradle-2.10
and I get the result
-bash: export: `Studio.app/Contents/gradle/gradle-2.10': not a valid identifier
what should I do?
Upvotes: 7
Views: 4815
Reputation: 21965
You can do it either this
export GRADLE_HOME=/Applications/Android\ Studio.app/Contents/gradle/gradle-2.10
way or this
export GRADLE_HOME="/Applications/Android Studio.app/Contents/gradle/gradle-2.10"
Important
Having taken so much pain in exporting the variable correctly, always make sure that you double quote the variable when you reference it in shell ie do:
"$GRADLE_HOME"
and not
$GRADLE_HOME
Example :
ls $GRADLE_HOME
will produce unexpected results.
Upvotes: 11