Interactions in pipe command 

Newsgroups: comp.unix.shell
>Please make suggestion on how to interact with users in pipe command.
>I am writing a sh shell script that read data from pipe while having
>the capability to interact with user.
>
>Previously I use
>  read ans < /dev/tty
>to get user input while preserving the stdio contents. Then I want
>to add timeout capability for the read. So I added
>  stty -icanon min 0 time $timeout
>before the read. But I get the error message:
> stty: standard input: Invalid argument
>
>What's your suggestion?
>
>The "-F device" in Linux might help, but Solaris doesn't have that...

Try;

stty -icanon min 0 time $timeout </dev/tty

laura fairhead

Interactions in pipe command 

If you are using (or can use) bash (since 2.03 or 2.04), the read command accepts a time-out value:

read -t $timeout ans < /dev/tty

Chris F.A. Johnson