I have a configuration file like this:
//filename : stat.conf
LAS_SERVER="127.0.0.1"
LAS_PORT=3306
LAS_USER=root
LAS_PWD=root
LAS_DB=test
CONN_STR_LAS_DB="-h$LAS_SERVER -P$LAS_PORT -u$LAS_USER -p$LAS_PWD $LAS_DB"
Now I run the source command like this:
$ source ./stat.conf
$ echo $CONN_STR_LAS_DB
testot.0.1
You can see that the result is wrong. not in our expectation.
In contrast, I can get the right result if I run the command in the shell like this:
$ LAS_SERVER="127.0.0.1"
$ LAS_PORT=3306
$ LAS_USER=root
$ LAS_PWD=root
$ LAS_DB=test
$ CONN_STR_LAS_DB="-h$LAS_SERVER -P$LAS_PORT -u$LAS_USER -p$LAS_PWD $LAS_DB"
$ echo $CONN_STR_LAS_DB
-h127.0.0.1 -P3306 -uroot -proot test
This is the right result.
So, my question is: why I got the wrong result when using "source ./stat.conf" ?
I tested the same operation on another computer, I can get the right result. Is there anything that I missed to config on my computer?
My OS is CentOS 5.