Clint Adams wrote: > On Wed, Feb 25, 2009 at 03:28:50AM +0100, Vincent Lefevre wrote: > > Aliases are not expanded with the -c option, as shown below. > > > > vin% cmd=$(printf "emulate sh\nalias a='echo OK >&2'\na") > > vin% printf "%s\n" "$cmd" > > emulate sh > > alias a='echo OK >&2' > > a > > vin% printf "%s" "$cmd" | zsh -f > > OK > > vin% zsh -fc "$cmd" > > zsh:3: command not found: a > > vin% > > > > There's no such problem with ksh93, bash in POSIX mode, and dash > > (pdksh has the same bug). > > That does appear to be the behavior.
Yes, at least as far as native zsh mode goes this isn't a bug. The command passed is treated as a single piece of text that's parsed in one go, so the alias isn't available until afterwards (by which time the shell has exited). This is the same behaviour as other chunks of code read in one go. To get script-like behaviour, don't use "-c", use a script argument. -- Peter Stephenson <p...@csr.com> Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org