zsh-users
 help / color / mirror / code / Atom feed
From: Dominik Vogt <dominik.vogt@gmx.de>
To: zsh-users@sunsite.auc.dk
Subject: Re: problem with named directories over the net
Date: Mon, 14 Jan 2002 17:40:39 +0100	[thread overview]
Message-ID: <20020114174039.F633@lifebits.de> (raw)
In-Reply-To: <27644.1011014849@dis.strath.ac.uk>; from sinclair@dis.strath.ac.uk on Mon, Jan 14, 2002 at 01:27:29PM +0000

On Mon, Jan 14, 2002 at 01:27:29PM +0000, Duncan Sinclair wrote:
> Hi,
> 
> Dominik writes:
> >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?
> 
> 
> In my .zshenv I have this code....
> 
> # Going for hack of the year award...
> case "$PWD" in
>     /tmp_mnt/*) cd '/tmp_mnt' '' ;;
>     /export/*)  cd '/export'  '' ;;
>     *) ;;
>   esac
> 
> It was put there to get around older Sun automounter difficulties...
> (It is no-longer necessary, but it does no harm...)
> 
> If you want to be really pro-active, you could try something like
> this in your precmd function...
> 
>   precmd() {
>     case "$PWD" in
>       /net/server/share/*) cd '/net/server/share' '' ;;
>       *) ;;
>     esac
>   }

Works like a charm - with a few minor modifications.  First, you
can put that in the chpwd function to have the code executed only
when the working directory changes.  Second, the slash before the
asterisk in the case value prevents that it works on the top
directory itself since PWD does not have the trailing slash for
directories.  I now use this script:

  chpwd ()
  {
    case "$PWD" in
      /net/server/share/home*)
        cd '/net/server/share' ''
        ;;
      /net/server/share/common*)
        cd '/net/server/share' ''
        ;;
      *)
        ;;
    esac
  }

Where "common" is a named directory pointing to
/net/server/share/common and /home is a symbolic link.


Bye

Dominik ^_^  ^_^

-- 
Dominik Vogt, email: d.vogt@lifebits.de
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20


  reply	other threads:[~2002-01-14 16:41 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
2002-01-14 13:27 ` Duncan Sinclair
2002-01-14 16:40   ` Dominik Vogt [this message]
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=20020114174039.F633@lifebits.de \
    --to=dominik.vogt@gmx.de \
    --cc=d.vogt@lifebits.de \
    --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).