From: Nemeth Ervin <airwin@inf.bme.hu>
To: zsh-users@sunsite.auc.dk
Subject: Re: Perl like select()?
Date: 27 Aug 1999 12:56:09 +0200 [thread overview]
Message-ID: <gmvvha17ara.fsf@kempelen.iit.bme.hu> (raw)
In-Reply-To: Zefram's message of "Wed, 25 Aug 1999 17:16:04 +0100 (BST)"
Hi!
>>>>> Zefram writes:
> Josh Howard wrote:
>> Is there any way, in a script, to use a "Perl-like" select() to
>> associate stdout with a particular file, before the execution of the
>> rest of the script?
> exec > file
> permanently redirects stdout. Any redirection can be used this way.
If you want to keep std{in,out,err}, you can also use a new descriptor.
Example:
# -*- sh -*-
local i file
file=~/.ssh/known_hosts
reply=()
[[ -r $file ]] || return
exec 5< $file
while read -u5 -A i
do
reply=($reply $i[1])
done
exec 5<&-
--
____ ____________________________________________________
/____| NEMETH, ERVIN |____________________________________________________|
// < airwin @ inf.bme.hu > http://www.inf.bme.hu/~airwin
||
|| "Nonsense. All you have to do is say 'Engage'"
|| -- Patrick Stewart about warp theory
next prev parent reply other threads:[~1999-08-27 10:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-08-25 15:48 Josh Howard
1999-08-25 16:16 ` Zefram
1999-08-25 16:48 ` Owen M. Astley
1999-08-25 17:00 ` Bart Schaefer
1999-08-25 17:08 ` Owen M. Astley
1999-08-25 16:49 ` Bart Schaefer
1999-08-25 18:35 ` Josh Howard
1999-08-27 10:56 ` Nemeth Ervin [this message]
1999-08-25 16:26 Jay Sekora
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=gmvvha17ara.fsf@kempelen.iit.bme.hu \
--to=airwin@inf.bme.hu \
--cc=zsh-users@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).