zsh-users
 help / color / mirror / code / Atom feed
From: Meino Christian Cramer <Meino.Cramer@gmx.de>
To: phil@fifi.org
Cc: zsh-users@sunsite.dk
Subject: Re: Command != command ???
Date: Mon, 25 Jul 2005 18:06:21 +0200 (CEST)	[thread overview]
Message-ID: <20050725.180621.74752305.Meino.Cramer@gmx.de> (raw)
In-Reply-To: <87ll3vmsi1.fsf@ceramic.fifi.org>

From: Philippe Troin <phil@fifi.org>
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 <Meino.Cramer@gmx.de> 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.
> 


  reply	other threads:[~2005-07-25 16:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-24  5:42 Meino Christian Cramer
2005-07-24 22:12 ` Philippe Troin
2005-07-24 23:22   ` Bart Schaefer
2005-07-25  3:06   ` Meino Christian Cramer
2005-07-25  3:32     ` Philippe Troin
2005-07-25  3:45       ` Meino Christian Cramer
2005-07-25  4:14         ` Philippe Troin
2005-07-25 16:06           ` Meino Christian Cramer [this message]
2005-07-25  3:54       ` Bart Schaefer
2005-07-25  4:15         ` Philippe Troin
2005-07-25 18:00   ` Meino Christian Cramer
2005-07-25 18:24     ` Philippe Troin
2005-07-25 18:53       ` Meino Christian Cramer
2005-07-25 19:20         ` Philippe Troin
2005-07-25 19:35           ` Meino Christian Cramer
2005-07-25 22:37             ` Philippe Troin
2005-07-26  0:33               ` Meino Christian Cramer
2005-07-26  2:21                 ` Philippe Troin
2005-07-26  4:20                 ` Sami Samhuri
2005-07-27 18:25                   ` Meino Christian Cramer
2005-07-26  5:07                 ` Bart Schaefer
2005-07-27  2:50                   ` Meino Christian Cramer
2005-07-26 10:28                 ` Peter Stephenson

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=20050725.180621.74752305.Meino.Cramer@gmx.de \
    --to=meino.cramer@gmx.de \
    --cc=phil@fifi.org \
    --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).