Catching console output interactively

B

Byrom, R (Rob)

hi,

I'd like to be able to trap console output as the user writes interactively.
For example if the user press the up or down keys I'd like to be able to
catch this and return the last executed command (a bit like the bash_history
idea). Can anyone point me in the right direction?

thanks for any help,

Rob
 
J

Jarek Zgoda

Dnia Fri, 16 Apr 2004 13:56:24 +0100, Byrom, R (Rob) pisze:
I'd like to be able to trap console output as the user writes
interactively. For example if the user press the up or down keys I'd
like to be able to catch this and return the last executed command (a
bit like the bash_history idea). Can anyone point me in the right
direction?

This is feature of GNU readline library, available on some Unix and
Unix-like systems. If you want to build something, that resembles Unix
shells, you can use class Cmd from cmd module. This class uses readline if
it is available on host system. I don't know, how it behaves on Windows
and if it uses capabilities of cmd.exe.
 
M

Miki Tebeka

Hello Rob,
I'd like to be able to trap console output as the user writes interactively.
For example if the user press the up or down keys I'd like to be able to
catch this and return the last executed command (a bit like the bash_history
idea). Can anyone point me in the right direction?
Depending on what you'd like to do you can try:
"curses" module (available only on unix like systems)
wxPython
PyGame

HTH.
Miki
 
M

Miki Tebeka

Hello Rob,
I'd like to be able to trap console output as the user writes interactively.
For example if the user press the up or down keys I'd like to be able to
catch this and return the last executed command (a bit like the bash_history
idea). Can anyone point me in the right direction?
Depending on what you'd like to do you can try:
"curses" module (available only on unix like systems)
wxPython
PyGame

HTH.
Miki
 
M

Michael Hudson

Byrom said:
hi,

I'd like to be able to trap console output as the user writes interactively.
For example if the user press the up or down keys I'd like to be able to
catch this and return the last executed command (a bit like the bash_history
idea). Can anyone point me in the right direction?

What platform?

Cheers,
mwh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top