zsh-users
 help / color / mirror / code / Atom feed
* odd recursion
@ 2005-01-31 16:24 William Scott
  2005-01-31 16:46 ` Bart Schaefer
  2005-01-31 16:54 ` Thorsten Kampe
  0 siblings, 2 replies; 7+ messages in thread
From: William Scott @ 2005-01-31 16:24 UTC (permalink / raw)
  To: ZSH-users

Hi Everyone:

I stumbled onto something that makes me realize there is a lot to zsh I 
don't understand.  I've resolved the problem, but I still don't 
understand it.

The problem comes about if I first define an alias for a command and 
then a posix function for the same command.  Issuing the command after 
doing this results in a recursion and my system freezes up if I am not 
quick with the control-C key.  I am using zsh on OS X v. 10.3.  This 
happens at least with zsh v. 4.1.1 and the current 4.2.3.

Just to be sure, I issue these commands first:

unalias ls
unalias lf
unfunction ls
unfunction lf

alias lf='command ls -Fa'
lf () {
         command ls --color=auto -lh ${*} | egrep "^d"
         command ls --color=auto -lh $* 2>& - | egrep -v "^d|total "
}

Then use lf.

It looks like some sort of recursion happens, even though I don't see 
logically what it is, and I have prefixed ls with "command" in each 
case.

The ONLY cure I found (apart from not doing this) is to use

function lf { commands }



syntax instead of posix syntax.  Then it all works.

The bash to zsh book gave me the impression that the two syntaxes are 
now equivalent.  Clearly that impression is wrong.

Thanks for any insights.

Bill



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-02-01  2:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-31 16:24 odd recursion William Scott
2005-01-31 16:46 ` Bart Schaefer
2005-01-31 16:54 ` Thorsten Kampe
2005-01-31 18:16   ` William Scott
2005-01-31 20:44     ` Seth Kurtzberg
2005-01-31 23:30       ` William Scott
2005-02-01  2:48         ` Bart Schaefer

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).