From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11719 invoked from network); 28 May 2006 15:58:31 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.2 (2006-05-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.2 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 May 2006 15:58:31 -0000 Received: (qmail 16567 invoked from network); 28 May 2006 15:58:24 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 May 2006 15:58:24 -0000 Received: (qmail 1815 invoked by alias); 28 May 2006 15:58:14 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10326 Received: (qmail 1687 invoked from network); 28 May 2006 15:56:32 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 28 May 2006 15:56:32 -0000 Received: (qmail 14104 invoked from network); 28 May 2006 15:56:32 -0000 Received: from pne-smtpout2-sn2.hy.skanova.net (81.228.8.164) by a.mx.sunsite.dk with SMTP; 28 May 2006 15:56:32 -0000 Received: from falcon.midgard.homeip.net (83.253.29.241) by pne-smtpout2-sn2.hy.skanova.net (7.2.072.1) id 44741F04000C7CF2 for zsh-users@sunsite.dk; Sun, 28 May 2006 17:56:31 +0200 Received: (qmail 44704 invoked from network); 28 May 2006 17:56:31 +0200 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with SMTP; 28 May 2006 17:56:31 +0200 Received: (qmail 1702 invoked by uid 1001); 28 May 2006 17:56:31 +0200 Date: Sun, 28 May 2006 17:56:31 +0200 From: Erik Trulsson To: zsh-users@sunsite.dk Subject: Re: Double Colon in $PATH Message-ID: <20060528155631.GA1614@owl.midgard.homeip.net> Mail-Followup-To: zsh-users@sunsite.dk References: <20060528153204.GG2700@plenz.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060528153204.GG2700@plenz.com> User-Agent: Mutt/1.5.11 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. -- Erik Trulsson ertr1013@student.uu.se