zsh-users
 help / color / mirror / code / Atom feed
* Issue redirecting zsh output
@ 2004-09-01 23:50 Stephen Bach
  2004-09-01 23:54 ` Stephen Bach
  2004-09-02  3:41 ` Bart Schaefer
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Bach @ 2004-09-01 23:50 UTC (permalink / raw)
  To: zsh-users

Hello,

I'm looking for a way to redirect all output of an interactive shell session.
It seems to me that I would be able to do this with a call such as
"zsh >/dev/null 2>&1" (to get rid of it completely), but this doesn't seem to
be working 100%.

Below is the behaviour of bash, which works as I expected:

steve@juniper$ bash >/dev/null 2>&1
ls *
cat jdklhjshs
exit
steve@juniper$ 

And here is zsh (the '>' is to differentiate the zsh prompt from bash's '$'):
steve@juniper$ zsh >/dev/null 2>&1
steve@juniper> ls *
steve@juniper> cat jdklhjshs
steve@juniper> exit
steve@juniper$ 

As you can see, for some reason zsh's prompt is not redirected.  NB the
behaviour is the same if zsh is called from zsh instead of from bash.

Thanks for any insight!

Stephen


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Issue redirecting zsh output
  2004-09-01 23:50 Issue redirecting zsh output Stephen Bach
@ 2004-09-01 23:54 ` Stephen Bach
  2004-09-02  3:41 ` Bart Schaefer
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Bach @ 2004-09-01 23:54 UTC (permalink / raw)
  To: zsh-users

On Wed, Sep 01, 2004 at 07:50:02PM -0400, Stephen Bach wrote:
>
> Blah
> 

FYI, this is version 4.2.0.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Issue redirecting zsh output
  2004-09-01 23:50 Issue redirecting zsh output Stephen Bach
  2004-09-01 23:54 ` Stephen Bach
@ 2004-09-02  3:41 ` Bart Schaefer
  2004-09-03 15:59   ` Stephen Bach
  1 sibling, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2004-09-02  3:41 UTC (permalink / raw)
  To: Stephen Bach; +Cc: zsh-users

On Wed, 1 Sep 2004, Stephen Bach wrote:

> As you can see, for some reason zsh's prompt is not redirected.

That's because ZLE deliberately re-opens /dev/tty.  If you don't want to 
see the prompt, you have to turn off the line editor:

	zsh +Z 2>&1 >/dev/null


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Issue redirecting zsh output
  2004-09-02  3:41 ` Bart Schaefer
@ 2004-09-03 15:59   ` Stephen Bach
  2004-09-03 16:15     ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Bach @ 2004-09-03 15:59 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

On Wed, Sep 01, 2004 at 08:41:48PM -0700, Bart Schaefer wrote:
> 
>   zsh +Z 2>&1 >/dev/null
> 

Yes, that seems to do the trick.  Thanks!

Now a related problem -- I see that if the user has "setopt zle" in their
.zshrc, the +Z flag is overridden.  Is there a way to force command-line
flags to take precedence (or antecedence, depending on how you look at it)?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Issue redirecting zsh output
  2004-09-03 15:59   ` Stephen Bach
@ 2004-09-03 16:15     ` Peter Stephenson
  2004-09-03 16:45       ` Stephen Bach
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2004-09-03 16:15 UTC (permalink / raw)
  To: zsh-users

Stephen Bach wrote:
> Now a related problem -- I see that if the user has "setopt zle" in their
> .zshrc, the +Z flag is overridden.  Is there a way to force command-line
> flags to take precedence (or antecedence, depending on how you look at it)?

Not unless you use -f to suppress execution of the startup files
altogether.

I don't know of any good reason to have `setopt zle' explicitly in
.zshrc.  It would have to be for some weird case where the shell didn't
detect the terminal properly.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Issue redirecting zsh output
  2004-09-03 16:15     ` Peter Stephenson
@ 2004-09-03 16:45       ` Stephen Bach
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Bach @ 2004-09-03 16:45 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-users

On Fri, Sep 03, 2004 at 05:15:37PM +0100, Peter Stephenson wrote:
> I don't know of any good reason to have `setopt zle' explicitly in
> .zshrc.  It would have to be for some weird case where the shell didn't
> detect the terminal properly.

I agree, but it's possible so I have to account for it.  For my purposes
I've decided to use a separate .zshrc which sources the user's (if present),
and then explicitly unsets zle.  It's not pretty, but it seems to be working.

Thanks guys


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-09-03 16:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-01 23:50 Issue redirecting zsh output Stephen Bach
2004-09-01 23:54 ` Stephen Bach
2004-09-02  3:41 ` Bart Schaefer
2004-09-03 15:59   ` Stephen Bach
2004-09-03 16:15     ` Peter Stephenson
2004-09-03 16:45       ` Stephen Bach

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).