On Sun, 19 Jul 2009 23:20:41 +0000 Clint Adams <sch...@debian.org> wrote: > On Sun, Jul 19, 2009 at 07:16:51PM +0200, martin f krafft wrote: > > % eval 'lt() { (_lt-en $*; _en-lt $*) | more }' > > zsh: parse error near `()' > > > > Alright, so lt is special: > > > > % which lt > > lt: aliased to ls -lt
Assuming lt was defined as an alias first, this has always been the wrong thing to do: % alias lt="one two" % eval 'lt() { (_lt-en $*; _en-lt $*) | more }' % which one two one () { ( _lt-en $* _en-lt $* ) | more } two () { ( _lt-en $* _en-lt $* ) | more } This is not a new feature; it's been mentioned in the FAQ for many years. 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. -- Peter Stephenson <p...@csr.com> Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK 'member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom' -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org