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.
Help!
TIA
eddiec :-)
|
|
0
|
|
|
|
Reply
|
chalk (34)
|
12/20/2005 12:31:02 AM |
|
"pc" <chalk@netspace.net.au> 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.
|
|
0
|
|
|
|
Reply
|
daneNO (319)
|
12/20/2005 1:18:37 AM
|
|
On Tue, 20 Dec 2005 02:18:37 +0100, Dan Espen <daneNO@SPAM.mk.telcordia.com> wrote:
> "pc" <chalk@netspace.net.au> 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.
Given that the script is fooling with the stty command, if the OP
cannot change that, he need to use pseudo-terminal (pty).
To the OP:
I don't remember all the incantations required off the top of my
hat, but as a basis for futher googling/man-pageing:
The left-hand-side script (the one doing "echo") opens a "master pty"
- nowadays, you open /dev/ptmx, every open of this one produces a new
pty. A pty has two sides, the master and the slave. The slave is created
in /dev/pts, e.g. /dev/pts/3.
The right-hand side of your pipe opens the slave. That means there is
not formally a pipe, your code must first create the pty, then
you do .x.ksh < /dev/pts/$n with the right $n.
To find out which of the files in /dev/pts is the new one, you must do
a system call... Yes, man ptmx says you must run three system calls
before you can allow the right hand side open the slave. That pretty
much means you must do a little C programming to do this.
-Enrique
|
|
0
|
|
|
|
Reply
|
enrio (209)
|
12/20/2005 4:12:20 AM
|
|
pc <chalk@netspace.net.au> wrote:
> 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
Alter the way you take input in the script. You appear to be using sme
method that wants a terminal.
> Help!
What about? You'll have to be precise about the problem. State the
command you are using.
Peter
|
|
0
|
|
|
|
Reply
|
ptb (2756)
|
12/20/2005 8:33:05 AM
|
|
On Mon, 19 Dec 2005 23:12:20 -0500, Enrique Perez-Terron <enrio@online.no> wrote:
> On Tue, 20 Dec 2005 02:18:37 +0100, Dan Espen <daneNO@SPAM.mk.telcordia.com> wrote:
>
>> "pc" <chalk@netspace.net.au> 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.
>
> Given that the script is fooling with the stty command, if the OP
> cannot change that, he need to use pseudo-terminal (pty).
As long as the script doesn't exit on error the OP can probably
ignore that error and the script will likely behave as expected.
It's probably trying to turn off echo or some such.
|
|
0
|
|
|
|
Reply
|
joe248 (217)
|
12/20/2005 6:51:29 PM
|
|
|
4 Replies
48 Views
(page loaded in 1.503 seconds)
Similiar Articles: a unix script to send email notification when a sas batch job ...So I'm wondering if this information could be used to write a short simple unix script which ... then you just need to send this command, unmodified, into the standard input ... Script to Pipe Output to File and Recycled Based on File Size ...using popen to execute and feed input to set of executable files ... ... doesn't pose a limit to output file size ... should be able to write a modified pipe script ... eclipse debugging and standard input - comp.lang.java.programmer ...My program is a parser that accepts standard input and should beexecuted like:cat file.txt ... input - comp.lang.java ... copy of a table out of a pdf file - comp.text ... stupid newbie: how to write to standard error? - comp.lang.awk ...> > Incidentally, instead of: > awk -f script.awk < infile > outfile ... Hi all, Don't know if these are the results of a standard ... Subject: Server can't write to the TCP ... GUI for Fortran programs - comp.lang.fortranI would like to write a software using Fortran 95, but I need also ... user click on a GUI control causes the Tcl/Tk GUI to generate text that is fed to the standard input ... input & output in assembly - comp.lang.asm.x86For Standard Input, use AH=0Ah, DS:DX points to your buffer, which is as follows ... learning assembly programming (read/write files, read keyboard, write to screen in text ... Need help figuring out how to write the script for this problem ...Need help figuring out how to write the script for this problem. Follow ... Thanks to some help I ... You may need to do a ... Problem with script - "The input ... fgets / read / select - comp.unix.programmerI am trying to write a function that works like fgets ... standard input is not a tty - comp.unix.solaris fgets / read ... How to Select and Deselect Blocks of Text in Word 2010 ... Keyboard Input - comp.lang.asm.x86I have been trying to figure out how to write a text input driver that is loaded by a boot sector. I recently started a post about printing characters... How to set the cursor to the end of a input box? - comp.lang ...Keyboard Input - comp.lang.asm.x86... trying to figure out how to write a text input ... is stored in the keyboard buffer, and a pointer ... TEST AL, 80h ;Test codes for ... Standard Input and Output RedirectionIn the following example, myprog, which was written to read standard input and write ... to other open files, or can be explicitly referenced in the shell scripts. How to Write Bash Script to Accept Input Parameters | eHow.comBash is the default shell for Unix. If you're not familiar with what a "shell" is, it's alternatively known as a "command prompt" and "terminal" on Windows and Mac ... 7/28/2012 7:39:14 AM
|