zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: d.vogt@lifebits.de, zsh-users@sunsite.dk
Subject: Re: problem with named directories over the net
Date: Mon, 14 Jan 2002 18:11:32 +0000	[thread overview]
Message-ID: <1020114181132.ZM18591@candle.brasslantern.com> (raw)
In-Reply-To: <20020114174039.F633@lifebits.de>

On Jan 14,  5:40pm, Dominik Vogt wrote:
} Subject: Re: problem with named directories over the net
}
} 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.

I had been about to suggest that myself, but if you ever happen to
'setopt chaselinks' you could end up with an infinite loop on your
hands, so I didn't.  Also, if it's in chpwd it won't get executed
the first time a new shell starts up, which might make a difference
in a few rare cases.

Of course you can insert a call to chpwd at the end of your .zshrc, and if
you use the zsh/parameter module you could prevent the infinite loop with:

    chpwd ()
    {
	[[ $funcstack == chpwd*chpwd* ]] && return
	# ... etc. ...
    }

} 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
}   }

Is it really the case that only `home' and `common' are automounted?
Anyway, having an empty *) fallthrough is redundant.  Why not just:

    chpwd ()
    {
	[[ $PWD == /net/server/share/* ]] && cd /net/server/share ''
    }

(plus possible loop protection per above)?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2002-01-14 18:11 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
2002-01-14 18:11     ` Bart Schaefer [this message]
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=1020114181132.ZM18591@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=d.vogt@lifebits.de \
    --cc=zsh-users@sunsite.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).