Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Double Colon in $PATH
- X-seq: zsh-users 10326
- From: Erik Trulsson <ertr1013@xxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Double Colon in $PATH
- Date: Sun, 28 May 2006 17:56:31 +0200
- In-reply-to: <20060528153204.GG2700@xxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20060528153204.GG2700@xxxxxxxxx>
On Sun, May 28, 2006 at 05:32:04PM +0200, Julius Plenz wrote:
> Hi!
>
> I recently discovered (rather by accident, though) that a double-colon
> in the PATH variable is treated by Zsh (Ash and Bash, too) as if there was
> ".", the current directory, in the PATH variable.
>
> Example:
>
> prompt> echo $PATH && pwd
> ::
> /bin
> prompt> ls
> [directory listing of /bin]
>
> Now this is really confusing me. I've already asked several people,
> and neither one of them could tell my why Zsh (and other shells) do
> this. I'd appreciate it very much if any of you guys could give me a
> hint or explain this behaviour to me.
Spending a few minutes reading man-pages reveals the following:
The man-page for bash(1) says:
[...]
PATH The search path for commands. It is a colon-separated list of
directories in which the shell looks for commands (see COMMAND
EXECUTION below). A zero-length (null) directory name in the
value of PATH indicates the current directory. A null directory
name may appear as two adjacent colons, or as an initial or
trailing colon. The default path is system-dependent, and is
set by the administrator who installs bash. A common value is
`/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin''.
[...]
The sh(1) manpage (on FreeBSD) says:
[...]
2. The shell searches each entry in PATH in turn for the command. The
value of the PATH variable should be a series of entries separated
by colons. Each entry consists of a directory name. The current
directory may be indicated implicitly by an empty directory name, or
explicitly by a single period.
[...]
I assume that zsh treats empty directory names in $PATH in the same
way even though I could not find it in the manpages.
--
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@xxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author