but after setting the environmental variables
It looks like you did not do that correctly.
The errors you're getting mean that the paths (like
/home/john/android) are being used as the names of variables, rather than as the values assigned to them.
- The correct syntax to assign a variable is
- The correct syntax to export a variable (with whatever value, if any, it has already been assigned) is
- The correct syntax to assign and export a variable (with the assigned value) at the same time is
I suspect you are attempting to do the third thing but using wrong syntax. Four common mistakes that could produce errors like what you're seeing are:
Using spaces instead of
export NAME value is incorrect;
value is then interpreted as the name of a subsequent variable to export.
(This happens because
export NAME1 NAME2 is correct syntax for exporting multiple variables.)
Putting spaces around
=. In many programming languages, it's both valid and stylistically preferred to pad operators with spaces most of the time. But to assign a value to a variable in a shell script (or other situation where you are issuing shell commands), this is not allowed.
NAME = value (in an
export command or otherwise) won't work; you must use
export NAME = value tries to export variables named
value. Fortunately this never appears to succeed silently because attempting to export a variable called
= is a syntax error. In contrast
export NAME= value will appear to work, but does not assign
NAME--instead, it assigns the empty, zero-length string to
NAME and exports it, and separately exports the variable
value. Both are common mistakes.)
Separating parts of the variable's value with spaces. Environment variables can contain spaces, but in practice they are rarely used as field separators in environment variables. When a single variable intentionally contains multiple paths, usually
: is used to separate them.
Not quoting spaces when assigning to variables. Sometimes an environment variable's value is supposed to contain a space. For example, it might be the name of a directory that really contains a space. In that case, it's necessary to quote any spaces.
One way to do this is to precede them with
\. See How can I protect parentheses passed to a cd command? and Unable to delete file for information on other ways--the methods presented in the answers apply, even though neither question is specifically about assigning to environment variables.
For example, here are a few ways to export the environment variable
SILLYPATH with the value
export SILLYPATH=/home/ek/silly\ name/bin
export SILLYPATH='/home/ek/silly name/bin'
export SILLYPATH="/home/ek/silly name/bin"
Often when a folder that you must use in a shell or assign to a widely used environment variable contains a space, it might benefit from being renamed. (But sometimes that's impractical or undesirable.)
I suspect this may be enough information for you to find and fix the bug in your
.bashrc file. If you need further help, you should of course post the full contents of that file for analysis. (It is only by coincidence that your problem happened to be one sufficiently frequently encountered, and with a sufficiently transparent error message, to make a general answer like this one possible.)