Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: strange alias effects
- X-seq: zsh-users 3097
- From: "Andrej Borsenkow" <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: "Andy Spiegl" <zsh.Andy@xxxxxxxxx>, "ZSH User List" <zsh-users@xxxxxxxxxxxxxx>
- Subject: RE: strange alias effects
- Date: Mon, 29 May 2000 15:44:13 +0400
- Importance: Normal
- In-reply-to: <20000529115637.A26887@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author