From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1750 invoked from network); 25 Jul 2005 04:15:14 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 25 Jul 2005 04:15:14 -0000 Received: (qmail 73636 invoked from network); 25 Jul 2005 04:15:08 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Jul 2005 04:15:08 -0000 Received: (qmail 22935 invoked by alias); 25 Jul 2005 04:14:57 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9152 Received: (qmail 22905 invoked from network); 25 Jul 2005 04:14:57 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 25 Jul 2005 04:14:57 -0000 Received: (qmail 71972 invoked from network); 25 Jul 2005 04:14:57 -0000 Received: from tantale.fifi.org (64.81.251.130) by a.mx.sunsite.dk with SMTP; 25 Jul 2005 04:14:50 -0000 Received: from ceramic.fifi.org (Debian-exim@ceramic.fifi.org [64.81.251.131]) by tantale.fifi.org (8.9.3p2/8.9.3/Debian 8.9.3-21) with ESMTP id VAA15660; Sun, 24 Jul 2005 21:14:46 -0700 Received: from phil by ceramic.fifi.org with local (Exim 4.34) id 1DwuMY-0002IL-9M; Sun, 24 Jul 2005 21:14:46 -0700 To: Meino Christian Cramer Cc: zsh-users@sunsite.dk Subject: Re: Command != command ??? References: <87r7dnsvjn.fsf@ceramic.fifi.org> <20050725.050633.74748820.Meino.Cramer@gmx.de> <87sly3mug9.fsf@ceramic.fifi.org> <20050725.054514.63127481.Meino.Cramer@gmx.de> Mail-Copies-To: nobody From: Philippe Troin Date: 24 Jul 2005 21:14:46 -0700 In-Reply-To: <20050725.054514.63127481.Meino.Cramer@gmx.de> Message-ID: <87ll3vmsi1.fsf@ceramic.fifi.org> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,PLING_QUERY autolearn=no version=3.0.4 Meino Christian Cramer writes: > I am a little confused here -- seems that what I believed to know > previously is wrong... > > ...I am booting my linux box directly into an X-Server with a kdm > login...The shell I start then is...interactively, right? .zshrc > setopts my extendedglob...then I start a script from there...which > again is not interactively...and will "loose" some features I set in > my .zshrc... > > Is this correct? No, when you start a zsh script (A) from a zsh "interactive session" shell (B), A starts completely anew. The only thing inherited from B by A are the environment variables and some other irrelevant state (opened file descriptors, limits, etc). All the rest (options, etc) is lost. > Is there a list where I can identify those features, which are not > valid for scripts, if set in .zshrc? Or do I have to read through the > whole zshall manpage? In a nutshell: zshenv is always read in all non-pathological cases zprofile is read if your shell is a login shell zshrc is read if your shell is interactive zlogin is read if your shell is a login shell So zprofile and zlogin are equivalent except for the sourcing order (if one is read, the other is read too). We have four combinations: login and interactive: this is the case when logging in through telnet, ssh, and sometimes for shells started by X terminal emulators (depending on your settings); login and non-interactive: I've only seen it used by some display managers when you login (most recent gdm/kdm versions do that, as well as CDE); non-login interactive: eg. a sub-shell, opened by zsh itself or from vi, screen, etc; non-login and non-interactive: scripts. I myself use .zshenv, .zprofile and .zshrc this way: In .zshenv, I put: environment variables definitions: bracketed by an if statement, and only executed if SOME_VARIABLE is unset. SOME_VARIABLE is set at the end of zshenv); some kind of aliases or autoloads: For example ll='ls -l', because I want to use ll like this some times: 'ssh machine ll /some/dir'; all the options that are not relevant to interactive use but which I may use via 'ssh machine command' (eg. rc_quotes, magicequalsubst, etc). In .zprofile, I do once-a-time initialization (eg. run under ssh-agent if not already), terminal initialization, limits settings, everything that's inherited from process to sub-process. Finally .zshrc takes care of: completions, zle and keyboard settings, prompts, and interactive setopts and autoloads. Phil.