* path/PATH function
@ 1997-11-19 15:37 Sweth Chandramouli
1997-11-19 16:20 ` Bruce Stephens
1997-11-19 16:27 ` Bart Schaefer
0 siblings, 2 replies; 5+ messages in thread
From: Sweth Chandramouli @ 1997-11-19 15:37 UTC (permalink / raw)
To: zsh-users
i long time ago, i wrote a quick function to take a list of
space-delimited dirs, check to see if each one was currently in my path, and if
not, add it. i was just trying to make some changes to it, when i noticed in my
.zshrc (modified from one that i got from someone else) a line saying
cdpath=(. .. ~)
i hadn't declared $CDPATH anywhere in my .z* files, but echoing $CDPATH
after login returned
.:..:/home/sweth/sweth
i'm assuming that this is some sort of zsh path-addition option, along
the lines of what i had created; i couldn't find any reference to it in the FAQ,
however, other than a note in the wish-list for users to "be able to create
their own foopath/FOOPATH array/path combinations." does anyone know anything
more about this feature?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: path/PATH function
1997-11-19 15:37 path/PATH function Sweth Chandramouli
@ 1997-11-19 16:20 ` Bruce Stephens
1997-11-19 16:27 ` Bart Schaefer
1 sibling, 0 replies; 5+ messages in thread
From: Bruce Stephens @ 1997-11-19 16:20 UTC (permalink / raw)
To: zsh-users
[I'm reading from zsh-3.1.2, but I think this is the same in 3.0.5]
sweth@astaroth.nit.gwu.edu said:
> cdpath=(. .. ~)
> i hadn't declared $CDPATH anywhere in my .z* files, but echoing
> $CDPATH after login returned
> .:..:/home/sweth/sweth
sweth@astaroth.nit.gwu.edu said:
> i'm assuming that this is some sort of zsh path-addition option, along
> the lines of what i had created; i couldn't find any reference to it
> in the FAQ, however, other than a note in the wish-list for users to
> "be able to create their own foopath/FOOPATH array/path
> combinations." does anyone know anything more about this feature?
Look at the zshparam manpage. cdpath and CDPATH are linked in the same way as
path and PATH. typeset -U may also be relevant: it tells zsh to keep only the
first element of identical copies, and comments that this also works with
special variables like PATH and CDPATH.
Note that there's a typo in the description: should be "For arrays keep only
the first element of each duplication.", not "...duplications". I think,
anyway, perhaps there's a better way to phrase it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: path/PATH function
1997-11-19 15:37 path/PATH function Sweth Chandramouli
1997-11-19 16:20 ` Bruce Stephens
@ 1997-11-19 16:27 ` Bart Schaefer
1997-11-21 19:23 ` Sweth Chandramouli
1 sibling, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 1997-11-19 16:27 UTC (permalink / raw)
To: Sweth Chandramouli, zsh-users
On Nov 19, 10:37am, Sweth Chandramouli wrote:
} Subject: path/PATH function
}
} i long time ago, i wrote a quick function to take a list of
} space-delimited dirs, check to see if each one was currently in my path,
} and if not, add it.
}
[describes cdpath mapping onto CDPATH]
}
} i'm assuming that this is some sort of zsh path-addition option, along
} the lines of what i had created; i couldn't find any reference to it in the
} FAQ, however, other than a note in the wish-list for users to "be able to
} create their own foopath/FOOPATH array/path combinations." does anyone
} know anything more about this feature?
This "feature" is restricted at present to a few pairs of variables that are
hardwired at compile time. They include:
CDPATH cdpath
FPATH fpath
MAILPATH mailpath
MANPATH manpath
PATH path
These are documented in `man zshparam` and in the info files. The remark
in the FAQ refers to the desire to provide arbitrary user-defined pairs
of variables that behave this way.
You might also wish to look into `typeset -U` which causes an array to
remove all non-unique elements from itself. A function to test whether
any given directory is already in your path shouldn't be necessary.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: path/PATH function
1997-11-19 16:27 ` Bart Schaefer
@ 1997-11-21 19:23 ` Sweth Chandramouli
1997-11-24 10:04 ` Bruce Stephens
0 siblings, 1 reply; 5+ messages in thread
From: Sweth Chandramouli @ 1997-11-21 19:23 UTC (permalink / raw)
To: zsh-users
On Wed, Nov 19, 1997 at 08:27:51AM -0800, Bart Schaefer wrote:
> This "feature" is restricted at present to a few pairs of variables that are
> hardwired at compile time. They include:
>
> CDPATH cdpath
> FPATH fpath
> MAILPATH mailpath
> MANPATH manpath
> PATH path
maybe the documentation i have isn't that complete, but all i could find
in the manpage for zshparam is the fact that the variables like cdpath and path
exist and are "special" varaibles; there isn't any mention of how they are
mapped on to their capitalized counterparts. my next question, then, is if
these do, in fact, work the way i surmised (that is, they remove redundancies
and map their colon-delimited versions onto the capitalized equivalent
variable). also, what exactly is the format for defining them? is it just
paren-enclosed, space-delimited lists?
> You might also wish to look into `typeset -U` which causes an array to
> remove all non-unique elements from itself. A function to test whether
> any given directory is already in your path shouldn't be necessary.
the version of typeset on my system doesn't seem to support this option
(or at least, the man page doesn't mention it). typeset doesn't return an error
if i try to use the -U switch, however; could someone summarize the syntax so i
could see if it is, in fact, implemented?
tia,
sweth.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: path/PATH function
1997-11-21 19:23 ` Sweth Chandramouli
@ 1997-11-24 10:04 ` Bruce Stephens
0 siblings, 0 replies; 5+ messages in thread
From: Bruce Stephens @ 1997-11-24 10:04 UTC (permalink / raw)
To: zsh-users
sweth@astaroth.nit.gwu.edu said:
> my next question, then, is if these do, in fact, work the way i
> surmised (that is, they remove redundancies and map their
> colon-delimited versions onto the capitalized equivalent variable).
Yes, but there's no removing of redundancies. There's back-mapping too, if you set CDPATH then cdpath gets set.
sweth@astaroth.nit.gwu.edu said:
> also, what exactly is the format for defining them? is it just
> paren-enclosed, space-delimited lists?
Yes, standard array syntax.
sweth@astaroth.nit.gwu.edu said:
> the version of typeset on my system doesn't seem to support this
> option (or at least, the man page doesn't mention it). typeset
> doesn't return an error if i try to use the -U switch, however; could
> someone summarize the syntax so i could see if it is, in fact,
> implemented?
Try:
cdpath=(.. ..)
echo $cdpath ;# Should give ".. .."
typeset -U cdpath
echo $cdpath ;# Should give ".."
Works in my 3.1.2 beta, anyway. I don't know whether typeset -U is in 3.0.5.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1997-11-24 10:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-19 15:37 path/PATH function Sweth Chandramouli
1997-11-19 16:20 ` Bruce Stephens
1997-11-19 16:27 ` Bart Schaefer
1997-11-21 19:23 ` Sweth Chandramouli
1997-11-24 10:04 ` Bruce Stephens
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).