From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17164 invoked from network); 26 Feb 2005 22:18:18 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 26 Feb 2005 22:18:18 -0000 Received: (qmail 33429 invoked from network); 26 Feb 2005 22:18:12 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 26 Feb 2005 22:18:12 -0000 Received: (qmail 29326 invoked by alias); 26 Feb 2005 22:17:55 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8550 Received: (qmail 29315 invoked from network); 26 Feb 2005 22:17:54 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 26 Feb 2005 22:17:54 -0000 Received: (qmail 32214 invoked from network); 26 Feb 2005 22:17:54 -0000 Received: from moonbase.zanshin.com (64.84.47.139) by a.mx.sunsite.dk with SMTP; 26 Feb 2005 22:17:50 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.13.1/8.13.1) with ESMTP id j1QMHniH031512 for ; Sat, 26 Feb 2005 14:17:49 -0800 Date: Sat, 26 Feb 2005 14:17:49 -0800 (PST) From: Bart Schaefer Reply-To: Bart Schaefer To: zsh-users@sunsite.dk Subject: Re: Named directories In-Reply-To: <2e24629722633f291ea82664e14cbc5d@ee.oulu.fi> Message-ID: References: <2e24629722633f291ea82664e14cbc5d@ee.oulu.fi> X-Face: "f/X=UCVgd*^c>+x(gMq0at?e:woX+;'snkkRzc3SX<0AZ (/PS4.M2hzGS9X:Qj]at_H/%a9K}:-eS<"v_7vX84PG9Bf Zpb`wI!I4geY=or+nWq`3CX`oq&TJR;g^ps|7(MH?jh;bs %vHJfCh5>a*6Re5m|Bidja\\o]>n\A)ib1:yX*T`zR(*h~ %tOw<~!D9{e6h!8M2:d8G2@K>y^1I_Vdy\d\MYe]z7c MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="1413522991-711615141-1109456269=:18748" X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1413522991-711615141-1109456269=:18748 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT On Mon, 21 Feb 2005, Mika Seppänen wrote: > If my homedir is /home/foo and I have named directory: > > work=/home/foo/bar > > Then if I switch to that dir (cd work), %~ expands to ~/bar. Is there any way > to make it expand to ~work? One thing that no one has mentioned in this thread is that %~ will always expand to the shortest possible string. Thus, given two=$HOME/bin three=$HOME/bin four=$HOME/bin you'll always see ~two because "two" is shorter than "/bin". Even if you "unset two", you'll never see ~three because both "/bin" and "four" are shorter than "three". Because ~/bin and ~four are of equal length, what you see is (I believe) dependent on hash table ordering, and therefore unpredictable (though it should always be consistent). Hey, PWS and the UTF-8 gang: If "bin" were in fact a name consisting of three wide characters, i.e., they display as three characters but occupy 6 or more bytes, would the prompt code treat ~three as a shorter string for purposes of the %~ expansion? --1413522991-711615141-1109456269=:18748--