[plug] bash: making cd persist after script has run
Colin Muller
colin at twobluedots.com.au
Mon Feb 11 10:22:44 WST 2002
I'd like to have a small bash script which I can use to do quick cd's
to the directories I visit most frequently as I work. So, being a
shell scripting naif, I wrote one like this:
case $1
in
perl)
cd /home/colin/info/tech/perl
;;
xml)
cd /home/colin/info/tech/xml-sgml
;;
esac
Then I placed this (named ccd) in my home directory, and typed:
~/ccd xml
~/ccd perl
etc etc
But of course, the shell script returns me to the directory I invoked
it from once it has run (it does cd to the wanted dir in between - I
checked that by placing a pwd in the script above). Is there a way to
make the 'cd' performed in the script persist after it's run?
Or is there some better way I could approach this?
I'm on bash 2.05
Colin
More information about the plug
mailing list