Asked • 06/20/19

Why doesn't "cd" work in a shell script?

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 saved this file as proj, added execute permission with `chmod`, and copied it to `/usr/bin`. When I call it by: `proj`, it does nothing. What am I doing wrong?

2 Answers By Expert Tutors


Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.