using cd command in a file

Kaleb Keithley kaleb at thyme.jpl.nasa.gov
Tue May 21 08:32:07 AEST 1991


In article muquit at garfield.ncat.edu (MUHAMMAD A. MUQUIT) writes:
>In article Charles Blair writes:
>>
>>   I would like to get to a directory /me/A/B/C/D by just typing j.  I tried
>>creating a file j with cd /me/etc in it, then chmod +x j.  It didn't work.
>>Thanks in advance.  I'm sure I'm overlooking something well-known.
>
>You can do the job if you put this line in your .login file:
>     alias j 'cd /me/A/B/C/D'
>
>I'm also curious why your way didn't work.  I think there are lots of gurus
>out there to answer this.

I'm not a guru, but if you consider that the shell that is running the 
script is a different shell than the one you are typing from.  

The shell that is running the script changes directories, and then exits, 
returning you to your original shell, which, BTW, never changed directories.

-- 
Kaleb Keithley                        kaleb at thyme.jpl.nasa.gov

Meep Meep                             Roadrunner
Veep veep                             Quayle



More information about the Comp.unix.questions mailing list