From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1564 invoked from network); 11 Jan 2002 13:06:24 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Jan 2002 13:06:24 -0000 Received: (qmail 13507 invoked by alias); 11 Jan 2002 13:06:12 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4577 Received: (qmail 13494 invoked from network); 11 Jan 2002 13:06:11 -0000 To: zsh-users@sunsite.auc.dk Subject: Re: problem with named directories over the net In-reply-to: "Dominik Vogt"'s message of "Fri, 11 Jan 2002 13:41:58 +0100." <20020111134158.F852@lifebits.de> Date: Fri, 11 Jan 2002 13:05:41 +0000 Message-ID: <1936.1010754341@csr.com> From: Peter Stephenson Dominik Vogt wrote: > I like to shorten my prompt by using '~' instead of the full path > to my home directory. For example: > > / $ cd ~/bin > ~/bin $ > > Now the problem occurs when I fire up mc. Upon leaving mc, a > script from the mc documentation cds into the current path and I > get something like > > /net/server/share/home/luthien/bin $ > > as the prompt because this is where my home directory comes from. > /home is a symbolic link to /net/server/share/home. Any idea how > I can prevent this? You can generically prevent anything like this by altering HOME to the resolved path in your .zshrc: if [[ $PWD = $HOME(|/*) ]]; then newdir=${PWD##$HOME} HOME=$(cd $HOME && pwd -r || print $HOME) cd $HOME${newdir} unset newdir else HOME=$(cd $HOME && pwd -r || print $HOME) fi This produces HOME=/net/server/share/home/luthien in your case. That's a general case --- you can shorten the code if you assume a particular form for $HOME before and after resolution. If you want to keep inside the symbolic link, since it's mc that's resolving the link and presenting zsh with it, and zsh can't tell if there's a symbolic link pointing to the current directory, it looks like you need to handle this case specially in mc somehow. Obviously you can replace /net/server/share/home with /home in the directory before changing to it. cd ${$(<"$MC")##/net/server/share} What more are you looking for? -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************