linux console command line history

K

kaklis

Hi to all,
I 'm writing a linux console app with sockets. It's basically a client
app that fires commands in a server.
For example:
$log user 55
$sessions list
$server list etc.
What i want is, after entering some commands, to press the up arrow
key and see the previous commands that i have executed.
Any hints? Any examples?

Antonis
 
B

Benjamin Kaplan

Hi to all,
I 'm writing a linux console app with sockets. It's basically a client
app that fires commands in a server.
For example:
$log user 55
$sessions list
$server list etc.
What i want is, after entering some commands, to press the up arrow
key and see the previous commands that i have executed.
Any hints? Any examples?

Antonis
--

Look at the readline module.
http://docs.python.org/library/readline.html
 
M

Michele Simionato

Hi to all,
I 'm writing a linux console app with sockets. It's basically a client
app that fires commands in a server.
For example:
$log user 55
$sessions list
$server list etc.
What i want is, after entering some commands, to press the up arrow
key and see the previous commands that i have executed.
Any hints? Any examples?

Antonis

You may find interesting to look at the source code for plac (http://
micheles.googlecode.com/hg/plac/doc/plac_adv.html). The readline
support (including command history and autocompletion) is implemented
in the ReadlineInput class (see http://code.google.com/p/micheles/source/browse/plac/plac_ext.py).
If you just want command history you can use rlwrap (http://
freshmeat.net/projects/rlwrap).
 
K

kaklis

You may find interesting to look at the source code for plac (http://
micheles.googlecode.com/hg/plac/doc/plac_adv.html). The readline
support (including command history and autocompletion) is implemented
in the ReadlineInput class (seehttp://code.google.com/p/micheles/source/browse/plac/plac_ext.py).
If you just want command history you can use rlwrap (http://
freshmeat.net/projects/rlwrap).

That's great! thank you so much Michele!

Antonis
 

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,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top