I\'m trying to write a small script to change the current directory to my project directory:
#!/bin/bash cd /home/tree/projects/java
I save
You can use . to execute a script in the current shell environment:
.
. script_name
or alternatively, its more readable but shell specific alias source:
source
source script_name
This avoids the subshell, and allows any variables or builtins (including cd) to affect the current shell instead.
cd