From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1404 invoked from network); 13 Jan 2000 08:44:14 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Jan 2000 08:44:14 -0000 Received: (qmail 18002 invoked by alias); 13 Jan 2000 08:44:01 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2871 Received: (qmail 17995 invoked from network); 13 Jan 2000 08:44:01 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) From: "Andrej Borsenkow" To: "Peter Stephenson" , Subject: RE: remote function problems. Date: Thu, 13 Jan 2000 11:43:58 +0300 Message-ID: <000001bf5da2$557cca70$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 > > 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