using cd command in a file
Daniel Smith "innovation, not litigation..."
daniel at island.COM
Wed May 22 04:26:35 AEST 1991
In <1991May20.155136.25162 at ux1.cso.uiuc.edu> ceblair at ux1.cso.uiuc.edu (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 may get a lot of answers telling you to make an alias so that
when you type 'j', you'll go where you want. I'll propose another solution
I've been using for several years.
In your ~/.cshrc file, add the element "~/.dirs" to the cdpath
variable. You may end up with something that looks like this:
set cdpath=(. ~ .. ../.. /usr ~/.dirs) # rearrange to suit...
Now, mkdir ~/.dirs, and cd into it...
As for your example, you could:
ln -s /me/A/B/C/D j
now source your ~/.cshrc, and you should be able to "cd j" and get
to where you want.
The underlying idea is that you are creating a directory (~/.dirs)
that potentially has a bunch of pointers (symbolic links) to places you like
to go to frequently. For instance, I "cd ulb" to go to /usr/local/bin,
"cd ubx" to go to /usr/bin/X11, and so on.
Daniel
--
daniel at island.com Daniel Smith, Island Graphics, (415) 491 0765 x 250(w)
daniel at world.std.com 4000 CivicCenterDrive SanRafael MarinCounty CA 94903
dansmith at well.sf.ca.us Fax: 491 0402 Disclaimer: Hey, I wrote it, not IG!
falling/yes I'm falling/and she keeps calling/me back again - IJSaF, Beatles
More information about the Comp.unix.questions
mailing list