The problem is, that you can't change the working directory of the parent process.
Related to your problem the procedure is as follows:
The current working directory of your interactive shell is
$PWD. Then you start
gotomusic and your interactive shell (i will call it
parentbash) starts a new instance of
bash (i call it
childbash) as a new process.
childbash inherits several attributes of
parentbash. Among other things it inherits it's working directory from
Since you instruct
childbash to read the commands from your script it changes its own working directory to
/media/sda8/Music and terminates.
At this point
parentbash gets active again with the same state as before the execution of
In order that
parentbash should invoke its
cd builtin command you should source your script. This is easily done by
But the question remains if this approach is well suited for a quick directory change.
There are several implementations of directory-bookmark systems
bashmarks but i think the best solution would be that you can easily choose from a list of the most used directories. I don't know whether there exists something like this for
bash but if you want to use
zsh you can get it at .