cd problems in bash

Hi,

I'm having problems with the "cd" command in bash not changing directories. From what I've read, I've gathered that scripts are child processes and can't change the directory of their parent process. How do I get around this problem?

Thanks,

Eric

You arrange your scripts so that you don't need children to change the directory of their parents.

Alternatives include

  1. referencing files by variables rather than assuming a particular current directory.

  2. make file references relative rather than absolute

  3. finding files using variables in similar manner to PATH

OK, thanks. So how exactly would I fix this script? This script is used for finding and entering the directory that the .parentlock file is located for firefox.

#!/bin/bash

direc=$(find -name ".parentlock" | grep firefox | sed s/.parentlock//)

cd $direc

Thanks