My First Shell Script

I am working on the Android source as a part of my course. And each time that I have to work on it, there are few commands (changing into the Working Directory, loading up the environment variables etc) that have to be run. I wanted to automate it with one command. Hence, created a shell script. I haven’t been totally unexposed to shell scripts but I have never made one.

There wasn’t much trouble doing this except for one. So there is a cd command. Apparently, shell scripts are run in a sub shell. And hence, the directory is changed in the sub-shell and not in your current shell. I looked up online, and found a neat way to work around it. So you need to just source the shell script. For eg.

 source <script_name>

Nice bit of learning experience!