Zsh Mailing List Archive
Messages sorted by:
Re: Command != command ???
- X-seq: zsh-users 9162
- From: Meino Christian Cramer <Meino.Cramer@xxxxxx>
- To: phil@xxxxxxxx
- Subject: Re: Command != command ???
- Date: Mon, 25 Jul 2005 18:06:21 +0200 (CEST)
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <87ll3vmsi1.fsf@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <87sly3mug9.fsf@xxxxxxxxxxxxxxxx> <20050725.054514.63127481.Meino.Cramer@xxxxxx> <87ll3vmsi1.fsf@xxxxxxxxxxxxxxxx>
From: Philippe Troin <phil@xxxxxxxx>
Subject: Re: Command != command ???
Date: 24 Jul 2005 21:14:46 -0700
The Tao of ZSH
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
Thanks so much, Philippe! :O)
(Could you please do the same miracle with the completion system ? ;)
> Meino Christian Cramer <Meino.Cramer@xxxxxx> 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
> 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.
Messages sorted by: