Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
f() { ...; } > file
- X-seq: zsh-workers 26010
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Subject: f() { ...; } > file
- Date: Wed, 5 Nov 2008 21:20:36 +0000
- Mail-followup-to: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Hiya,
$ bash -c 'foo() { echo a >&3; } 3>&1; foo'
a
$ ksh -c 'foo() { echo a >&3; } 3>&1; foo'
a
$ zsh -c 'foo() { echo a >&3; } 3>&1; foo'
foo: 3: bad file descriptor
$ ARGV0=sh zsh -c 'foo() { command echo a >&3; } 3>&1; foo'
foo: 3: bad file descriptor
It looks like zsh evaluates the redirection at the time the
function is defined rather than when it is called.
It's OK when declaring the function as
foo() echo a > file
or
foo() (echo a) > file
instead of
foo() { echo a; } > file
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author