Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Redirected function output



> 
> Redirect function output appears to screw up the shell.
> 
> sdlhpp33:daniel 5820> echo $ZSH_VERSION 
> 2.6-beta9-test2
> 
> sdlhpp33:daniel 5821> a()
> > {
> > echo a
> > }
> 
> sdlhpp33:daniel 5822> a > /dev/null
> 
> 
> In this case the lkast command does not return, if ran in a script then the 
> function returns, but the output of following commands is redirected to who 
> knows where ..... ^C does not even get the prompt back.

You can fix it with exec >& /dev/tty.

Here are some more details about that bug from my BUGS file I posted some time
ago (Richard, would you please update the BUGS file, it's very old. thaks).

Zoltan

------------------------------------------------------------------------
% foo () { : }
% true | true
% foo > /dev/null
The prompt will not come back and what you type is not echoed on the
terminal. You can get back the prompt if you blindly type
% exec >& /dev/tty
 
The following commands terminate an interactive shell:
% foo () { : }
% true | true
% foo <<< bar
% bar      <------ you do not have to type that. That's the result
zsh: command not found: bar
 
In both cases the problem is that the whole shell's stdin/stdout is
redirected instead of only the functions input/output. E.g. the the
second example does the same as
% exec <<< bar
% bar      <------ you do not have to type that. That's the result
zsh: command not found: bar
Termination is caused by EOF in stdin.
------------------------------------------------------------------------



Messages sorted by: Reverse Date, Date, Thread, Author