Changing Directory

Paul De Bra debra at alice.UUCP
Thu Aug 3 05:04:30 AEST 1989


In article <5068 at mtuxo.att.com> jld at mtuxo.att.com (XMRJ4-J.DALTON) writes:
>Well, Here goes,
>
>QUESTION: I have a very long path which is quite tedious to type in
>          every time I wish to visit a certain directory.
>	  My question: Is there a way that I can put this path in a 
>          file, then execute a shell that will place me in that directory?
>...

You can put the name in a file, say "f", and then do a
cd `cat f`
You cannot put the "cd longfilename" in a shell script and execute it
as the 'current directory' is only inherited from parent to child, not
the other way round.

If you have csh you can create an alias to do the job (see `man csh`)

If you have one of the newer shells with functions you create a function
mycd() {
   cd longfilename
}
export mycd

If you have an ancient bourne shell you are out of luck.

Paul.
-- 
------------------------------------------------------
|debra at research.att.com   | uunet!research!debra     |
------------------------------------------------------



More information about the Comp.unix.questions mailing list