[plug] bash: making cd persist after script has run

Justin justin at inwa.com.au
Mon Feb 11 10:31:48 WST 2002


How about edit .bashrc and put in some alias'
it
alias cdperl='cd /home/colin/info/tech/perl'
alias cdxml='cd /home/colin/info/tech/xml-sgml'

should work.

Justin

At 10:22 AM 11/02/2002 +0800, you wrote:
>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