zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: William Scott <wgscott@chemistry.ucsc.edu>,
	L:ZSH-users <zsh-users@sunsite.dk>
Subject: Re: odd recursion
Date: Mon, 31 Jan 2005 16:46:32 +0000	[thread overview]
Message-ID: <1050131164632.ZM31318@candle.brasslantern.com> (raw)
In-Reply-To: <5ced8dfb84fe26e20350095da48dd44d@chemistry.ucsc.edu>

On Jan 31,  8:24am, William Scott wrote:
}
} 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.

You stumbled on FAQ question number 2.3, "Why do my csh aliases not work?
(Plus other alias pitfalls.)"

  There is one other serious problem with aliases: consider

    alias l='/bin/ls -F'
    l() { /bin/ls -la "$@" | more }

  `l' in the function definition is in command position and is expanded
  as an alias, defining `/bin/ls' and `-F' as functions which call
  `/bin/ls', which gets a bit recursive.  This can be avoided if you use
  `function' to define a function, which doesn't expand aliases.  It is
  possible to argue for extra warnings somewhere in this mess.

  Bart Schaefer's rule is:  Define first those aliases you expect to
  use in the body of a function, but define the function first if the
  alias has the same name as the function.


  reply	other threads:[~2005-01-31 16:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-31 16:24 William Scott
2005-01-31 16:46 ` Bart Schaefer [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1050131164632.ZM31318@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=wgscott@chemistry.ucsc.edu \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).