Hi!

I'm doing this:


------- script.sh -------
#!/bin/ksh

for word in $(tr '\n' ' ');do
#             ^^ tr(1) reads from standard input
 ... some stuff ...
done

read FOO

case "${FOO}" in
 ... ... ...
esac
------- script.sh -------

$ script.sh < /foo/bar


The problem with this of course, is that I want `read' to read from the
user interactively, also from stdin, but stdin is piped to the script
(and subsequently to tr(1)) before `read'. So now `read' just gets eof.

I'm thinking about something along the lines of first "closing" the
stdin that is piped to the script (somehow, I don't know), then
reopening it (also, somehow). I know this sounds vague, but does the
concept makes sense at all?

I was playing around with something like this:

for word in $(tr ..);do; ... ;done

exec 3</dev/stdin
exec <&-
exec 0<&3

read FOO


Thanks for any pointers!

Daniel

-- 
LÉVAI Dániel
PGP key ID = 0x83B63A8F
Key fingerprint = DBEC C66B A47A DFA2 792D  650C C69B BE4C 83B6 3A8F

Reply via email to