Created by CecilWesterhof.
My .tclshrc
The part about setting the colours uses Get Colour Escape String and probably only works when using XWindows.
# In principal not necessary anymore, but: The cautious seldom err. - Confucius if {${tcl_interactive}} { package require tclreadline # To be able to enter expressions namespace path {::tcl::mathop ::tcl::mathfunc} # The output from this proc is used as primary prompt. proc ::tclreadline::prompt1 {} { set colour1 [getColour redLight] set colour2 [getColour white] set colour3 [getColour nothing] set user $::tcl_platform(user) if {${user} eq "root"} { set temp ${colour1} set colour1 ${colour2} set colour2 ${temp} } set currentDir [regsub "^/home/${user}" [pwd] ~] set dateTime [clock format [clock seconds] -format "%a, %e %b %T"] set host [lindex [split [info hostname] "."] 0] format "%s%s %s\[%s %s@%s:%s\]\n$ %s" \ ${colour1} \ tclsh${::tcl_version} \ ${colour2} \ ${dateTime} \ ${user} \ ${host} \ ${currentDir} \ ${colour3} } # I do not want unrecognised commands to be executed as shell commands. # This minimises the difference between a script and an interactive shell. # But this dimisses the usage as command line shell. # If you want to use it as a command line shell comment this out. set auto_noexec True # Start the readline loop ::tclreadline::Loop }
I use a terminal with a black background and a green font. This results in a prompt like:
tclsh8.6 [Wed, 6 Jun 06:58:28 cecil@munus:~]
Where the first part of the prompt is redlight and the second part is white. Except when the user is root: then the first part is white and the second part is redlight.
I can do:
** 3 27
Which returns:
7625597484987
As always: comments, tips and questions are appreciated.