From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26064 invoked from network); 25 Jul 2005 16:05:23 -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 16:05:23 -0000 Received: (qmail 22964 invoked from network); 25 Jul 2005 16:05:16 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Jul 2005 16:05:16 -0000 Received: (qmail 21941 invoked by alias); 25 Jul 2005 16:05:10 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9162 Received: (qmail 21931 invoked from network); 25 Jul 2005 16:05:09 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 25 Jul 2005 16:05:09 -0000 Received: (qmail 22083 invoked from network); 25 Jul 2005 16:05:09 -0000 Received: from p548526c8.dip0.t-ipconnect.de (HELO solfire) (84.133.38.200) by a.mx.sunsite.dk with SMTP; 25 Jul 2005 16:05:02 -0000 Received: from localhost ([127.0.0.1]) by solfire with esmtp (Exim 4.42) id 1Dx5TC-0005FU-3B; Mon, 25 Jul 2005 18:06:26 +0200 Date: Mon, 25 Jul 2005 18:06:21 +0200 (CEST) Message-Id: <20050725.180621.74752305.Meino.Cramer@gmx.de> To: phil@fifi.org Cc: zsh-users@sunsite.dk From: Meino Christian Cramer In-Reply-To: <87ll3vmsi1.fsf@ceramic.fifi.org> References: <87sly3mug9.fsf@ceramic.fifi.org> <20050725.054514.63127481.Meino.Cramer@gmx.de> <87ll3vmsi1.fsf@ceramic.fifi.org> X-Mailer: Mew version 4.1 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Rcpt-To: phil@fifi.org, zsh-users@sunsite.dk X-SA-Exim-Mail-From: Meino.Cramer@gmx.de Subject: Re: Command != command ??? Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SA-Exim-Version: 4.1+cvs (built Sat, 28 Aug 2004 13:10:40 +0200) X-SA-Exim-Scanned: Yes (on solfire) 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 From: Philippe Troin Subject: Re: Command != command ??? Date: 24 Jul 2005 21:14:46 -0700 Hi, The Tao of ZSH First Mantra the novice once asked the master guru: "Why are my scripts not executed though they are well designed?" The master guru only wrotes down a few words only. Then the novice was enlighted. ---- Sometimes only a few well formed words in a simple mail are worth a lot more than The Stories of One Thousand and one arabian Nights of zshall. Thanks so much, Philippe! :O) (Could you please do the same miracle with the completion system ? ;) Happy zshing! Novice Meino > 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. >