Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!dptg!ulysses!andante!alice!debra From: debra@alice.UUCP (Paul De Bra) Newsgroups: comp.unix.questions Subject: Re: Changing Directory Keywords: cd Message-ID: <9730@alice.UUCP> Date: 2 Aug 89 19:04:30 GMT References: <5068@mtuxo.att.com> Reply-To: debra@alice.UUCP () Distribution: usa Organization: AT&T, Bell Labs Lines: 30 In article <5068@mtuxo.att.com> jld@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@research.att.com | uunet!research!debra | ------------------------------------------------------