Possible Duplicate:
Why doesn’t “cd” work in a bash shell script?
Why does cd command in backticks or $(..) never change to the new directory. Any idea how to do it in a single command, that is capture any error and change directory.
[root@linux ~]# pwd
/root
[root@linux ~]# cmdMsg=`cd /tmp 2>&1`
[root@linux ~]# pwd
/root