History command

Timothy Grant tjg at hyperlinq.net
Fri Jul 6 23:16:04 EDT 2001


On Thu, Jul 05, 2001 at 11:14:36PM +0000, Ramzi Abu Nofal wrote:
> Hi all ,
> I am trying to find history command ( like history in Unix,or doskey in
> dos/win)
> to list all the command that have been executed .
> I can do it using the readline module, but I need to save the result of
> the
> commnad too.

I believe that the following taken from my python startup file
may do what you want.

histfile="%s/.python-history" % os.environ["HOME"]
readline.read_init_file('~/.inputrc')
readline.read_history_file(histfile)

def savehist():   
    global histfile
	readline.write_history_file(histfile)
	
atexit.register(savehist)
	

-- 
Stand Fast,
    tjg.

Timothy Grant                                www.hyperlinq.net 
Chief Technology Officer                     tjg at hyperlinq.net 
HyperLINq Technologies, Inc.                <>< (503) 246-3630
>>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
>>>>This machine was last rebooted:  32 days  3:14 hours ago<<




More information about the Python-list mailing list