zsh-users
 help / color / mirror / code / Atom feed
From: Erik Trulsson <ertr1013@student.uu.se>
To: zsh-users@sunsite.dk
Subject: Re: Double Colon in $PATH
Date: Sun, 28 May 2006 17:56:31 +0200	[thread overview]
Message-ID: <20060528155631.GA1614@owl.midgard.homeip.net> (raw)
In-Reply-To: <20060528153204.GG2700@plenz.com>

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@student.uu.se


  reply	other threads:[~2006-05-28 15:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-28 15:32 Julius Plenz
2006-05-28 15:56 ` Erik Trulsson [this message]
2006-05-28 18:34   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060528155631.GA1614@owl.midgard.homeip.net \
    --to=ertr1013@student.uu.se \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).