27

Can get the command history by using cursor key (like up arrow key) in TCL shell (tclsh).

I am running tclsh on fedora with linux version 2.6.21.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
Adi
  • 1,589
  • 3
  • 19
  • 27

3 Answers3

38

You want access to the readline library, you can do that with rlwrap:

$ rlwrap tclsh

Useful options are -c for file name completion, and -f to add words from a file to the completion list:

$ rlwrap -cf my_complete_file tclsh

Since you almost always want to use rlwrap, adding a shell alias is useful:

alias tclsh='rlwrap tclsh'
Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
glenn jackman
  • 238,783
  • 38
  • 220
  • 352
3

I usually use tkcon which comes with ActiveTcl, or as a separate installation. tkcon has many features, but the one I use the most is the command-line editing aspect.

Hai Vu
  • 37,849
  • 11
  • 66
  • 93
  • thanks vu tkcon was a nice suggestion.. I used it in ubuntu but getting some error "Application initialization failed: no display name and no $DISPLAY environment variable" when i use in fedora – Adi Jun 16 '10 at 05:16
  • Worked on Ubuntu 14.04. Unfortunately, it opens a GUI shell, does not run directly inside my xterm? :-( – Ciro Santilli OurBigBook.com Aug 03 '15 at 10:40
0

Another good pure-terminal option is tclsh-wrapper

Link to tclsh-wrapper on github

It provides rich command line editing, history, aliasing, and keyword completion but does not require X11. Documentation for the key mapping is also available.

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/30616901) – xom9ikk Dec 19 '21 at 08:58
  • IMHO, the essential parts are that another good solution exists a concise overview of that solution's features is provided. What's missing? Would it be better if no link was given? Note, the two top voted answers don't even include feature summaries. Feel free to elaborate and/or provide an example and I'll see what can be done to improve the answer. – Tom Drabenstott Dec 20 '21 at 15:54