Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Perl like select()?
- X-seq: zsh-users 2525
- From: Nemeth Ervin <airwin@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: Re: Perl like select()?
- Date: 27 Aug 1999 12:56:09 +0200
- In-reply-to: Zefram's message of "Wed, 25 Aug 1999 17:16:04 +0100 (BST)"
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <E11JfiW-0001Ad-00@xxxxxxxxxxxxxxxxxx>
- Sender: airwin@xxxxxxxxxx
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author