From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9558 invoked from network); 29 May 2000 11:45:14 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 29 May 2000 11:45:14 -0000 Received: (qmail 2414 invoked by alias); 29 May 2000 11:44:32 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3097 Received: (qmail 2407 invoked from network); 29 May 2000 11:44:27 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer david.siemens.de) From: "Andrej Borsenkow" To: "Andy Spiegl" , "ZSH User List" Subject: RE: strange alias effects Date: Mon, 29 May 2000 15:44:13 +0400 Message-ID: <000301bfc963$3615d910$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 In-reply-to: <20000529115637.A26887@br-online.de> > In my dot-files I've got this (among others): > alias psl='ps -eo > user,pid,ppid,cpu,pmem,rss,vsize,bsdtime,bsdstart,cmd --sort > user,pid | \grep -v "bsdtime,bsdstart"' > alias pslS='ps -eo > user,pid,ppid,cpu,pmem,rss,vsize,bsdtime,bsdstart,cmd --sort > -size | \grep -v "bsdtime,bsdstart"' > look.for () { psl | \grep -iE "(^USER|$@)" | \grep -v "grep -iE" } > alias lookall='psl | grep -vE "(^($USERNAME|root|bin))|login"' > > When I type > look.for ssh-agent > I get: > look.for: command not found: psl > > "lookall" works as usual. > This trick works for me: bor@itsrm2% cat ~/.zsh.d/functions/bar foo bor@itsrm2% alias foo='echo xxx' bor@itsrm2% autoload bar bor@itsrm2% bar xxx Note, that this works irrespectively of alias/autoload order. I actually think, that autoloading functions provides more clean way than definig them directly in dot-files. > After typing > look.for () { psl | \grep -iE "(^USER|$@)" | \grep -v "grep -iE" } > on the shell prompt, it works. > > Can anyone explain this to me, please? Well, aliases are not expanded in direct function defiition (correct me, Bart). Weirdly enough, they are expanded (by default) in autoloaded functions. -andrej