zsh-users
 help / color / mirror / code / Atom feed
From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: "Peter Stephenson" <pws@pwstephenson.fsnet.co.uk>,
	<zsh-users@sunsite.auc.dk>
Subject: RE: remote function problems.
Date: Thu, 13 Jan 2000 11:43:58 +0300	[thread overview]
Message-ID: <000001bf5da2$557cca70$21c9ca95@mow.siemens.ru> (raw)
In-Reply-To: <E128THU-0003Ox-00.2000-01-12-19-18-08@cmailg3.svr.pol.co.uk>

>
> Scott Lipcon wrote:
> > $ ssh hostname zsh -c function
> > slipcon's password:
> > zsh: command not found: function
> > $
> >
> > this is because I load my functions in my .zshrc - they're all in a file
> > called zfunc, and I say:
> >
> >
> > # load functions (necessary for completions)
> > [[ -r $HOME/.zsh/zfunc ]] && source $HOME/.zsh/zfunc
> >
> > in my zshrc.  (which is directly before I load in my completions, which
> > are in $HOME/.zsh/zcomp)
>
> You should move the code (and anything it depends on) to ~/.zshenv and
> everything will work without the -i.
>


We already discussed it. IMHO it is bad idea to put this in zshenv. This will be
executed for every shell, including zsh scripts, and not ony slows it down but,
what's worse, function defintions may clash with external commands; it may
redefine some commands script relies upon; etc ... If this happens in
interactive shell, it is more or less acceptable - you get immediate feedback.
But it may cause scripts to behave in unpredictable way.

zshenv is  not needed for scripts - at least, should not be needed. Scripts
should be self-contained. Almost the only use for zshenv is to redefine/augment
default module_path as zsh simply won't be usable without it's modules. Anything
else can be setup as needed in zshrc for interactive shells or in script itself
for scripts.

Why not make your command a shell script in the first place? It could then
source whatever function definitions it needs.

/andrej


  reply	other threads:[~2000-01-13  8:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-11  4:49 Scott Lipcon
2000-01-12  7:29 ` Andrej Borsenkow
2000-01-12 18:52   ` Scott Lipcon
2000-01-12 19:20     ` Peter Stephenson
2000-01-13  8:43       ` Andrej Borsenkow [this message]
2000-01-13  9:32         ` Zefram

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='000001bf5da2$557cca70$21c9ca95@mow.siemens.ru' \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=pws@pwstephenson.fsnet.co.uk \
    --cc=zsh-users@sunsite.auc.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).