Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: strange alias effects



[Redirected to zsh workers]

> > > So the problem probably starts when there are more
> aliases after the
> > > definition of bar.

No. The problem is, when alias and/or function are inside of ``if''
statement:

bor@itsrm2% cat foo
  alias psl='ps -eo user,pid,ppid,pri,pcpu,vsz,pmem,stime,time,args |
sort +1n -2 | \grep -v "stime,time"'
  alias pslS='ps -eo user,pid,ppid,pri,pcpu,vsz,pmem,stime,time,args |
sort -k 6,6n | \grep -v "stime,time"'
  look() { psl | head -1; psl | \egrep -i $@ | \grep -v egrep }
  alias lookall='psl | \egrep -v "($USER|root|bin)"'
bor@itsrm2% zsh -f
itsrm2% . ./foo
itsrm2% look
ps: unknown field name `pri'
ps: unknown field name `pri'
egrep: Usage: egrep [ -c | -l | -q ] [-insvxyhbr] -e pattern_list
                    [ -f pattern_file ] ... [file ...]
              egrep [ -c | -l | -q ] [-insvxyhbr] [ -e pattern_list ]
                      -f pattern_file ... [file ...]
              egrep [ -c | -l | -q ] [-insvxyhbr] pattern_list
                    [file ...]

but

bor@itsrm2% zsh -f
itsrm2% cat foo
if true; then
  alias psl='ps -eo user,pid,ppid,pri,pcpu,vsz,pmem,stime,time,args |
sort +1n -2 | \grep -v "stime,time"'
  alias pslS='ps -eo user,pid,ppid,pri,pcpu,vsz,pmem,stime,time,args |
sort -k 6,6n | \grep -v "stime,time"'
  look() { psl | head -1; psl | \egrep -i $@ | \grep -v egrep }
  alias lookall='psl | \egrep -v "($USER|root|bin)"'
fi
itsrm2% . ./foo
itsrm2% look
look: command not found: psl
look: command not found: psl
egrep: Usage: egrep [ -c | -l | -q ] [-insvxyhbr] -e pattern_list
                    [ -f pattern_file ] ... [file ...]
              egrep [ -c | -l | -q ] [-insvxyhbr] [ -e pattern_list ]
                      -f pattern_file ... [file ...]
              egrep [ -c | -l | -q ] [-insvxyhbr] pattern_list
                    [file ...]

This is current CVS with a couple of latest commits from Sven missing.

-andrej



Messages sorted by: Reverse Date, Date, Thread, Author