If you wish the script to be able to change the working directory in you current shell, you must
source the script instead of running it as a command. For example:
Code:
$ pwd
/home/user
$ echo "cd ~/misc" > testscript
$ . testscript
$ pwd
/home/user/misc
The dot followed by a space is what tells your shell to
source the script. Everything in that script will then execute in your current shell ... so be careful what you do!