Re: script to write to standard input ?



"pc" <chalk@xxxxxxxxxxxxxxx> writes:

> hi all,
>
> I have a script that I want to send some standard input to (eg simulate
> the user typing 'a' - ENTER ). If I try echo a | myscript, I receive an
> error: option:stty: : Not a typewriter
>
> This is running in ksh.

This depends on your script. For example:

Given x.sh:

#!/bin/ksh
read ans
echo "answer is $ans"

I get:

echo "aa" | ./x.ksh
answer is aa

Maybe the script shouldn't be fooling with the stty command.
.



Relevant Pages