Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <20050305193249.65710.qmail@web53401.mail.yahoo.com> Date: Sat, 5 Mar 2005 11:32:48 -0800 (PST) From: Dave Subject: Re: chere doesn't cd to directory To: cygwin AT cygwin DOT com In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii --- Igor Pechtchanski wrote: > On Sat, 5 Mar 2005, Dave wrote: > > --- Igor Pechtchanski wrote: > > > On Fri, 4 Mar 2005, Dave wrote: > > > > The cd occurs in /etc/profile for bash, ash, and pdksh; /etc/zprofile > > > > for zsh; /etc/csh.login for tcsh. > > > > > I don't recall if this was part of the discussion, but any particular > > > reason you're not doing this in a /etc/profile.d script instead? That > > > way, it would work even with a custom /etc/profile. > > > > I honestly hadn't thought of that... and I don't recall it being > > mentioned. > > > > The issue is that chere wants to stop the standard login script from > > doing the usual cd $(HOME). The profile.d scripts get run before the cd, > > and hence th cd happens anyway. If the order were changed, we'd have > > lost the directory we wanted anyway. These (and also that suggested by John in an earlier e-mail) still require a change to /etc/profile. i.e. People with custom /etc/profiles will still need to update them. > Another alternative is to wrap /etc/profile in another script and use > bash's --noprofile and --rcfile options (again, don't recall if this has > been discussed before). This one may work with bash, but I'm guessing the other shells aren't as accomodating. > > Also, tcsh reads the profile.d scripts from csh.cshrc rather than > > csh.login. So a non login tcsh shell would also run the snippet (and cd > > $(HOME)). > > Ah, this one's easy to solve. Just unset the variable after you do the > first "cd $(HOME)". :-) Then subsequent invocations will skip the > snippet. You've misunderstood me on this one. The csh profile.d file would require a { if CHERE_INVOKING unset CHERE_INVOKING; else cd HOME }. This would be run for login and non login shells. A login shell will then work as expected. A non login shell (which doesn't normally cd HOME) would cd HOME. This can be worked around, but why make trouble? Anyway, I don't mind coming up with a more update (and maintainer) friendly way for chere to get to the right directory, but I don't see that it's worth the effort and pain of users having to change their profile again. That said these modifications would take place in the base-files, zsh and tcsh packages (and chere wouldn't change); so if John, Peter or Corinna want to refactor things, that's OK with me. Dave. __________________________________ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/