As a beginner of bash
script, I wrote a simple script to change the directory. Here it is my source code:
#!/bin/bash
set -x
echo "---------------------START-----------"
cd /home/cocadas/Workspace/carnd/CarND-Behavioral-Cloning-P3
I save it as "start" in the /root
folder. I change the property of the file to be executable, and then run it as below. The problem is that the execution command cd
doesn't work. What did I miss?
cocadas@cocadas-ThinkPad-W540:~$ ./start
+ echo ---------------------START-----------
---------------------START-----------
+ cd /home/cocadas/Workspace/carnd/CarND-Behavioral-Cloning-P3 cocadas@cocadas-ThinkPad-W540:~$ cd
/home/cocadas/Workspace/carnd/CarND-Behavioral-Cloning-P3
cocadas@cocadas-ThinkPad-W540:~/Workspace/carnd/CarND-Behavioral-Cloning-P3$