# bash error when terminal opened



## Jermay (Jan 28, 2011)

Hello,

First of all I'm very new to unix so please forgive me newbness.

The problem is the following

I tried to install cakephp on my mac and when I had the export the $PATH variable ,something went wrong. When I start my terminal I get the following errors:

----
-bash: export: `:/Users/username/Library/cakephp/cake/console': not a valid identifier
-bash: export: `:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin': not a valid identifier
----

I did a quite a lot of googling and found lot threads about this path, but I don't now how to fix those since its not complaining about the $PATH variable.

echo $PATH gives

---
/opt/local/bin:/opt/local/sbin:/Applications/XAMPP/xamppfiles/bin:/Applications/MAMP/bin/php5.3/bin
---

I tried to install cakephp on mamp, but apperantly atleast the $PATH variable and something else is wrong.


----------



## artov (Jan 29, 2011)

Both error messages look the same: instead of exporting the variable, you are exporting its content.

In Unix (and most other operating systems), environment variables are names programs use to refer some text. So when you specify the name DOG to stand for Spot, all the programs know that your dog is named Spot. Normal use for environment variables is storing directory or file names.

In bash shell the environment variables work almost the same as bash's own variables. You set an variable as


```
DOG=Spot
```
and refer to it by using $ sign, like


```
echo $DOG
```

These variables are internal to the bash, so when you end the shell, the variables disappear. You use export command to make bash variable an environment variable (actually I guess it creates a new enviroment variable with same name and content):


```
export DOG
```

How do you refer to the environment variable? Like shell's internal variables:


```
echo $DOG
```

(It is common to use all uppercase letters for environment variables and small or mixed cased letters for internal variables).

So finally what has happened:

Your .bashrc file contains line


```
export $PATH
```

instead of 


```
export PATH
```

Bash evaluates content of the variable (/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin in your case) and gives it to the export command. Environment variable names can contain letters and numbers, not : sign.


----------

