zsh-users
 help / color / mirror / code / Atom feed
* Redirection in the middle of a script?
@ 1997-09-30  4:04 Jahwan Kim
  1997-09-30  6:01 ` Bart Schaefer
  1997-09-30  9:18 ` Andrew Main
  0 siblings, 2 replies; 3+ messages in thread
From: Jahwan Kim @ 1997-09-30  4:04 UTC (permalink / raw)
  To: zsh-users

Dear all,
    I have this long-standing question, which I can't find an answer to,
perhaps because it's impossible.  Is it possible to redirect
STDOUT/STDIN/STDERR/just about any file descriptor *in the middle of* a
script, not at the beginning?  That is,

#!/bin/zsh
... (part of which the STDOUT is, say, your terminal)
...
(some magical redirection command I'm looking for, which should do what
    perl's open STDOUT ">foo.out" will do)
... (and from this point on, everything you send to STDOUT will go to foo.out)
...

Am I asking too much to a mere shell?  :) 

Cheers,
Jahwan


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

* Re: Redirection in the middle of a script?
  1997-09-30  4:04 Redirection in the middle of a script? Jahwan Kim
@ 1997-09-30  6:01 ` Bart Schaefer
  1997-09-30  9:18 ` Andrew Main
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1997-09-30  6:01 UTC (permalink / raw)
  To: Jahwan Kim, zsh-users

On Sep 30, 12:04am, Jahwan Kim wrote:
} Subject: Redirection in the middle of a script?
}
}     I have this long-standing question, which I can't find an answer to,
} perhaps because it's impossible.  Is it possible to redirect
} STDOUT/STDIN/STDERR/just about any file descriptor *in the middle of* a
} script, not at the beginning?  That is,

You can do this in any Bourne-shell-like shell, even very old ones, with

exec <foo.in		# redirects stdin
exec >foo.out		# redirects stdout
exec 2>foo.err		# redirects stderr

This is all documented in the "Redirection" section of the zsh manual.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: Redirection in the middle of a script?
  1997-09-30  4:04 Redirection in the middle of a script? Jahwan Kim
  1997-09-30  6:01 ` Bart Schaefer
@ 1997-09-30  9:18 ` Andrew Main
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Main @ 1997-09-30  9:18 UTC (permalink / raw)
  To: Jahwan Kim; +Cc: zsh-users

Jahwan Kim wrote:
>(some magical redirection command I'm looking for, which should do what
>    perl's open STDOUT ">foo.out" will do)

exec >foo.out

-zefram


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

end of thread, other threads:[~1997-09-30  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-30  4:04 Redirection in the middle of a script? Jahwan Kim
1997-09-30  6:01 ` Bart Schaefer
1997-09-30  9:18 ` Andrew Main

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