Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Double input and 'exec' builtin
- X-seq: zsh-users 7556
- From: DervishD <raul@xxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Double input and 'exec' builtin
- Date: Thu, 17 Jun 2004 15:54:39 +0200
- Mail-followup-to: Zsh Users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: Pleyades
Hi all :)
I have a script that processes standard input and after that
prints some data and waits for user input, something like:
#!/bin/zsh
emulate -L zsh
select ITEM in `filter`
do
print $ITEM
break;
done
# End of script
Obviously this doesn't work, because 'select' needs standard
input (or the line editor) to read the user selection, but 'filter'
processes standard input as well!. Well, I've modified it like this:
#!/bin/zsh
emulate -L zsh
set `filter`
select ITEM
do
print $ITEM
break;
done
# End of script
thus separating the filter processing from the selection, but it
doesn't work either. I need to do the following in order to make it
work:
#!/bin/zsh
emulate -L zsh
set `filter`
exec < /dev/tty
select ITEM
do
print $ITEM
break;
done
# End of script
Is there any cleaner way of doing all this? I want to solve two
problems. First, the 'set' part. I don't really want to use the
positional parameters for this, although they won't be used in this
script. I've thought about using a shell parameter instead of 'set'
and positional parameters, and using ${(f)that_variable} for
generating the list for 'select'. The other problem is separating the
part of the script that processes standard input from the select,
without making two scripts and without that 'exec'.
Any idea? Thanks a lot for your help :)
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author