1 # Simple example of how the history extension
2 # can be used to provide line editing and history
4 # Build jimsh with the history extension and enable line editing (the default)
5 # ./configure --with-ext=history
7 package require
history
9 set histfile
[env HOME
]/.jtclsh
10 history load $histfile
12 if {[history getline
"jim> " cmd
] < 0} {
19 # Don't bother adding single char commands to the history
20 if {[string length
$cmd] > 1} {
22 history save
$histfile
25 # - check for a complete command: [info complete]
26 # - handle other non-error return codes and changes the prompt: [info returncodes]
27 # - displays the complete error message: [errorInfo]
29 set result
[eval $cmd]