zsh-users
 help / color / mirror / code / Atom feed
* Double Colon in $PATH
@ 2006-05-28 15:32 Julius Plenz
  2006-05-28 15:56 ` Erik Trulsson
  0 siblings, 1 reply; 3+ messages in thread
From: Julius Plenz @ 2006-05-28 15:32 UTC (permalink / raw)
  To: zsh-users

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.

Thank you!

Julius


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Double Colon in $PATH
  2006-05-28 15:32 Double Colon in $PATH Julius Plenz
@ 2006-05-28 15:56 ` Erik Trulsson
  2006-05-28 18:34   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Erik Trulsson @ 2006-05-28 15:56 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Double Colon in $PATH
  2006-05-28 15:56 ` Erik Trulsson
@ 2006-05-28 18:34   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2006-05-28 18:34 UTC (permalink / raw)
  To: zsh-users

On May 28,  5:56pm, Erik Trulsson wrote:
}
} I assume that zsh treats empty directory names in $PATH in the same
} way even though I could not find it in the manpages.

The zsh manual started out pretty much describing only the things that
zsh does differently, rather than describing everything it does whether
or not other shells are the same.  It's gradually been improving, but
only as missing bits get noticed.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-28 18:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-28 15:32 Double Colon in $PATH Julius Plenz
2006-05-28 15:56 ` Erik Trulsson
2006-05-28 18:34   ` Bart Schaefer

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).