Sending a down arrow key through ksh
All,
I have a KSH script which needs to navigate a menu automagically.
Right now it does something like:
echo "Y\nY\n..." | myprog > /logs/my.log
The Y {enter} Y {enter} is answering prompts correctly in myprog, but
right after that I am presented with a menu which I need to navigate
using the arrow keys. This means sending a {down} {down}\n and then
also sending the F10 key.
Is there a way to echo arrow and function keys via a ksh script?
Re: Sending a down arrow key through ksh
Pete пишет:[color=blue]
> All,
>
> I have a KSH script which needs to navigate a menu automagically.
> Right now it does something like:
>
> echo "Y\nY\n..." | myprog > /logs/my.log
>
> The Y {enter} Y {enter} is answering prompts correctly in myprog, but
> right after that I am presented with a menu which I need to navigate
> using the arrow keys. This means sending a {down} {down}\n and then
> also sending the F10 key.
>
> Is there a way to echo arrow and function keys via a ksh script?
>[/color]
A simple way for using arrow keys that `cat`.
up - ^[[A down - ^[[B left - ^[[D right - ^[[C
You can add this command symbols on vi/vim with pressing "Ctrl+V" and
"[" and litera from [A-D].
--
UV-RIPE
Re: Sending a down arrow key through ksh
On Oct 12, 11:00*pm, Vladimir Usenko <mc2_...@radiocom.net.ua> wrote:[color=blue]
> Pete пишет:> All,
>[color=green]
> > I have a KSH script which needs to navigate a menu automagically.
> > Right now it does something like:[/color]
>[color=green]
> > echo "Y\nY\n..." | myprog > /logs/my.log[/color]
>[color=green]
> > The Y {enter} Y {enter} is answering prompts correctly in myprog, but
> > right after that I am presented with a menu which I need to navigate
> > using the arrow keys. *This means sending a {down} {down}\n and then
> > also sending the F10 key.[/color]
>[color=green]
> > Is there a way to echo arrow and function keys via a ksh script?[/color]
>
> * A simple way for using arrow keys that `cat`.
> up - ^[[A down - ^[[B left - ^[[D right - ^[[C
> You can add this command symbols on vi/vim with pressing "Ctrl+V" and
> "[" and litera from [A-D].
>
> --
> UV-RIPE[/color]
Hmmm.....
I've tried this both with the echo tactic described above and by using
redirection like so:
myprog <<EOF
dosomething
domorethings
^[[B
^[[B
^[[21~
EOF
So that's "do something", "do some more things", "down", "down", "F10"
- but this it's just stopping after doing the second thing. No downs,
no F10. Are there any other variables I need to set-up in order for
redirection like this to acknowledge the escape sequence?
Re: Sending a down arrow key through ksh
"Pete" <peter.charbonnier@gmail.com> wrote in message
news:345549b5-6248-4a37-953f-8bba5e1711f4@c36g2000prc.googlegroups.com...
[color=blue]
>So that's "do something", "do some more things", "down", "down", "F10"
>- but this it's just stopping after doing the second thing. No downs,
>no F10. Are there any other variables I need to set-up in order for
>redirection like this to acknowledge the escape sequence?[/color]
If you get nowhere, try "expect" - works quite well once you've learned how
to drive it.
cheers,
clive