ksh alias question (I'm not proud)
Dawn E. Howe
dawn1 at ihuxy.ATT.COM
Tue May 2 23:15:11 AEST 1989
>From article <292 at tree.UUCP>, by stever at tree.UUCP (Steve Rudek):
> I thought I'd save myself some typing by building a file of paths to all
> my favorite directories and then defining the following alias.
> alias G='cd `grep $1 /usr/local/ut/paths`'
> It doesn't work--for the obviously reason that $1 isn't making it to the
> subshell. I've tried all manner of nested quotes. Suggestions on how to
> do this? I'd guess it could be done with an eval...but is that really
> necessary?
I don't have an answer for how to get your command to work, but there
is something to do this ALREADY BUILT INTO KSH.
Set (and export) the variable CDPATH to a colon(:)-separated list of
"favorite directories". The working directory is specified by a . or
a Null directory name, which can appear before the first :, after the
last :, or between : delimiters.
Here's how it works:
--------------------
If the directory that you specify for "cd" does not begin with a /, then
ksh searches each of the directories in the CDPATH in order for the
specified directory, and tries to cd to that directory.
Hope this helps.
Dawn E. Howe
AT&T Bell Labs
...dawn1 at ihuxy.att.com
or
...att!ihuxy!dawn1
More information about the Comp.unix.questions
mailing list