Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!csd4.milw.wisc.edu!srcsip!tcnet!nis!quad!dts From: dts@quad.uucp (David T. Sandberg) Newsgroups: comp.unix.questions Subject: Re: Changing Directory Keywords: cd Message-ID: <218@quad.uucp> Date: 6 Aug 89 07:59:31 GMT References: <5068@mtuxo.att.com> <9730@alice.UUCP> Reply-To: dts@quad.uucp (David T. Sandberg) Distribution: usa Organization: Quadric Systems, Richfield MN Lines: 41 In article <9730@alice.UUCP> debra@alice.UUCP () writes: >In article <5068@mtuxo.att.com> jld@mtuxo.att.com (XMRJ4-J.DALTON) writes: >>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 an ancient bourne shell you are out of luck. ? Why are the respondents seemingly avoiding the way I usually do it when stuck with Bourne shell? Namely, storing the directory path in an environment variable, ala... $ ACE=/usr/local/ace/reports/src/more/useless/nesting; export ACE $ cd $ACE In fact, on machines where I only have Bourne shell to work with (blech), I'll usually set up a number of these things in my .profile to have ready access to my most commonly-used directories in the most expedient fashion. And many of the people I've worked with have done the same thing - I'm quite surprised no one has yet suggested it here. (You could put the 'cd' in the environment variable as well, if you like, but I don't like to get that distant from sensible command lines...) I've never heard of a Bourne shell so primitive that it wouldn't handle this correctly. Or perhaps I've just been lucky? -- David Sandberg "bidibidibidibidi... here's PSEUDO: dts@quad.uucp your flower, Buck" ACTUAL: ..uunet!rosevax!sialis!quad!dts