bob parker wrote:
Hi all,
being a lazy typist i have writen a little script that
goes like this:
#! /bin/bash
# go-xxx where xxx is the last dir in along chain
cd /some long dir chain/xxx
My question is, how can i make the change persist
after the script is done
Thanks
Bob Parker
No need for a shell script here. Use bash's CDPATH variable (man bash)
and set
CDPATH=:/some/long/dir/chain
now, to go to directory xxx in /some/long/dir/chain, just type
cd xxx
and bash will search for that directory in your current directory as
well as in /some/long/dir/chain and go to the first one it finds
(similar to the PATH variable for executing commands)