<p>I'm trying to write a small script to change the current directory to my project directory:</p>

<pre><code>#!/bin/bash
cd /home/tree/projects/java
</code></pre>

<p>I saved this file as proj, added execute permission with <code>chmod</code>, and copied it to <code>/usr/bin</code>. When I call it by:
<code>proj</code>, it does nothing. What am I doing wrong?</p>

Shell scripts are run inside a subshell, and each subshell has its own concept of what the current directory is. The
```
cd
```
succeeds, but as soon as the subshell exits, you're back in the interactive shell and nothing ever changed there.
One way to get around this is to use an alias instead:
```
```
alias proj="cd /home/tree/projects/java"
```
```