zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-users@sunsite.auc.dk
Subject: Re: problem with named directories over the net
Date: Fri, 11 Jan 2002 13:05:41 +0000	[thread overview]
Message-ID: <1936.1010754341@csr.com> (raw)
In-Reply-To: "Dominik Vogt"'s message of "Fri, 11 Jan 2002 13:41:58 +0100." <20020111134158.F852@lifebits.de>

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 <pws@csr.com>                  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.
**********************************************************************


  parent reply	other threads:[~2002-01-11 13:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-11 12:41 Dominik Vogt
2002-01-11 12:55 ` Borsenkow Andrej
2002-01-11 14:28   ` Dominik Vogt
2002-01-11 14:35     ` Borsenkow Andrej
2002-01-11 15:36       ` Dominik Vogt
2002-01-11 14:41     ` Zefram
2002-01-11 15:38       ` Bart Schaefer
2002-01-11 15:50     ` Bart Schaefer
2002-01-11 18:51       ` Dominik Vogt
2002-01-11 13:05 ` Peter Stephenson [this message]
2002-01-14 13:27 ` Duncan Sinclair
2002-01-14 16:40   ` Dominik Vogt
2002-01-14 18:11     ` Bart Schaefer
2002-01-15 10:53       ` Dominik Vogt
2002-01-15 17:59         ` 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=1936.1010754341@csr.com \
    --to=pws@csr.com \
    --cc=zsh-users@sunsite.auc.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).