From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17730 invoked from network); 23 Jun 2008 16:17:06 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 23 Jun 2008 16:17:06 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 16800 invoked from network); 23 Jun 2008 16:17:00 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 Jun 2008 16:17:00 -0000 Received: (qmail 28825 invoked by alias); 23 Jun 2008 16:16:57 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25239 Received: (qmail 28811 invoked from network); 23 Jun 2008 16:16:57 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 23 Jun 2008 16:16:57 -0000 Received: from prunille.vinc17.org (vinc17.pck.nerim.net [213.41.242.187]) by bifrost.dotsrc.org (Postfix) with ESMTP id 6145180524FD for ; Mon, 23 Jun 2008 18:16:49 +0200 (CEST) Received: by prunille.vinc17.org (Postfix, from userid 501) id E0ABD238192B; Mon, 23 Jun 2008 18:16:48 +0200 (CEST) Date: Mon, 23 Jun 2008 18:16:48 +0200 From: Vincent Lefevre To: zsh-workers@sunsite.dk Subject: Re: environment settings Message-ID: <20080623161648.GI10734@prunille.vinc17.org> Mail-Followup-To: zsh-workers@sunsite.dk References: <20080616074651.GB26165@marcus> <20080616080556.GA5091@sc.homeunix.net> <20080616123045.GC26165@marcus> <20080616124450.GC5091@sc.homeunix.net> <20080621062649.GA28022@blorf.net> <20080621113659.GA20796@prunille.vinc17.org> <20080621123049.GA7027@sc.homeunix.net> <20080622084152.GQ10734@prunille.vinc17.org> <20080623152431.GM4961@sc.homeunix.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20080623152431.GM4961@sc.homeunix.net> X-Mailer-Info: http://www.vinc17.org/mutt/ User-Agent: Mutt/1.5.18-vl-r22984 (2008-06-11) X-Virus-Scanned: ClamAV 0.92.1/7541/Mon Jun 23 16:21:03 2008 on bifrost X-Virus-Status: Clean On 2008-06-23 16:24:31 +0100, Stephane Chazelas wrote: > Note that $SHELL is called for that purpose in a number of > places such as vi's :!, ftp's !, In those cases, sourcing the .zshenv doesn't hurt. On the contrary, it allows to define some aliases or whatever the user wishes. > ssh host 'cmd line'... not only gdb. ssh runs the user's default login shell on the remote host, which can be different from $SHELL. And this was the problem I was mentioning with bash: there's no way to set up some environment variables. So, with bash, "ssh -t host some_program" won't work if some_program is in the user's $HOME/bin directory, even though the user always has this directory in his $PATH. > It's true it would be nice to be able to distinguish between zsh > instances that are meant to be user shells that is that are > meant to parse command lines given by the user and instances > that are meant to run canonical zsh code where the user is not > meant to alter the zsh behavior (as in zsh scripts, zsh -c ...) Yes, but I doubt this would solve all the problems. When I use "zsh -c", I want .zshenv to be sourced (the reason is that I sometimes do "ssh [-t] host zsh -c ..." and the .zshenv is the *only* way to set up environment variables -- but I could also source my .zshenv at the beginning of the command string). > csh solves that with the -f option without which every csh > instance is sourcing .cshrc (so csh scripts have #! /bin/csh > -f). But this solution needs to hardcode the csh path in the script. Something like "#!/usr/bin/env csh -f" doesn't work everywhere. > With zsh, you could solve that by having $SHELL be > /path/to/user-zsh, user-zsh being a link to zsh and ~/.zshenv > having something like: > > [[ $0 != (*/|)user-zsh || -o interactive ]] || > . "${ZDOTDIR:-$HOME}/.zshrc" > > (not tested but you get the idea). Yes, nice idea. Concerning gdb (which is an exception), I could write a wrapper that sets some environment variable, which could be tested in the .zshenv to do what I want exactly. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)