Questions tagged [tclsh]

Simple shell containing Tcl interpreter. Consider using the tcl tag instead for language issues.

tclsh is a shell-like application that reads Tcl commands from its standard input or from a file and evaluates them. If invoked with no arguments then it runs interactively, reading Tcl commands from standard input and printing command results and error messages to standard output. It runs until the exit command is invoked or until it reaches end-of-file on its standard input. If there exists a file .tclshrc in the home directory of the user, tclsh evaluates the file as a Tcl script just before reading the first command from standard input.

For language issues, please tag with ; the tag is for issues with the tclsh shell itself.

99 questions
8
votes
2 answers

How to use the left and right arrow keys in the tclsh interactive shell (Ubuntu 14.04)?

Why can't I use the left and right arrow keys (actually, the same goes for the up and down keys as well) to move about the line I'm currently on in the tclsh interactive shell? If I try to press either one, I get a bunch of abracadabra instead of…
user4087080
4
votes
2 answers

tcl8.6: what is the built-in equivalent to 'atexit()' in stdlib or 'trap "..." EXIT' in bash?

I'm looking for a builtin or standard package that provides functionality that is similar or equivalent to stdlib's atexit() and bash' trap "..." EXIT. It should catch termination due to any programatic way of ending execution, including all of the…
rtx13
  • 2,580
  • 1
  • 6
  • 22
3
votes
1 answer

Strawberry Perl v5.30.0 not able to install Tcl (Windows 10)

I downloaded and installed strawberry-perl-5.30.0.1-64bit.msi from strawberryperl.com on my Windows 10 and tried to install Tcl module using cpan, but it fails for missing tclsh. What could be the problem? C:\Strawberry>cpan Tcl Loading internal…
andre___11
  • 31
  • 1
3
votes
2 answers

Why curly braces allow variable substitution?

Tcl manuals say that curly braces do not allow variable substitution. However this works only with some commands but not with others. What is the difference and how to identify the cases where the substitution will occur and the cases where it won't…
coder56
  • 43
  • 4
3
votes
1 answer

Different version of tcl giving different answers

I am running this function in tcl 8.0 verison. proc test {} { set owner 212549316 set val [regexp {[0-9]{9}} $owner] puts $val } The same code in tcl 8.6, the output is 1 but in tcl 8.0 it is 0. I am checking whether the string contains…
Ashish
  • 358
  • 2
  • 4
  • 15
3
votes
2 answers

Open wish without stealing focus

I want to open a Tcl/Tk dialog on linux (kde,vnc) and put some information in: package require Tk toplevel .my pack [label .my.l -text "hallo"] Doing this, the dialog opens and the new dialog takes the focus. How can I prevent this? package require…
tbasien
  • 87
  • 7
3
votes
3 answers

missing operand at _@_ in tcl script

in if condition I want to check whether the string contains the pattern, but i'm getting following error. missing operand at _@_ in expression " $extra_url eq _@_*user-new* " (parsing expression " $extra_url eq *user-n...") invoked from…
VijayD
  • 826
  • 1
  • 11
  • 33
3
votes
1 answer

Set up TCL to access tcl libraries

I am new to TCL and am struggling with accessing other modules. The SOURCE command helped me include other code that I have written in a TCL program. However, I think I have a problem with accessing libraries of code. For example, when I reference a…
user1985580
  • 61
  • 2
  • 4
3
votes
1 answer

TCL calling proc that is in another file, but the proc is not found: invalid command

I am new to TCL. I excute TCL code via: "tclsh85 FOD/Scripts/program1.tcl" from DOS window under Windows Vista. program1.tcl included a "set junk [tproc $a]" and this give "invalid command name tproc". tproc is defined in program2.tcl which is in…
user1985580
  • 61
  • 2
  • 4
2
votes
2 answers

In tclsh, [tab] will automatically execute the defined proc (with tclreadline)

my_tcl 7 % proc test args {puts "wwwww"} my_tcl 8 % test [tab]wwwww wwwww [tab] wwwww wwwww .gitignore README.md .vscode/ ... my_tcl 8 % test After two tabs the proc runs four times and then returns to the position before the tab. How should…
piper
  • 79
  • 4
2
votes
1 answer

order two list with the same indices

I am new to tcl. I need to sort a list of values and save indices. I have 2 lists and I want to sort listA, but then I want to order listB preserving the indices form listA. For example: set listA {5 6 7 3 4 7 8 9} set listB {0 1 2 3 4 5 6 7} set…
Alessandro Peca
  • 873
  • 1
  • 15
  • 40
2
votes
1 answer

Is there an alternative to the load command to import binary Tcl package

I am using a commercial tool interfaced with an homebrew tclsh(Synopsys EDA). In their version, they removed the load command. Thus I cannot use third party libraries (Graphviz library in my case). I wonder if there is a another way to import binary…
Krouitch
  • 596
  • 3
  • 13
2
votes
2 answers

Regex pattern behaving differently in TCL compared with Perl & Python

I am trying to extract a sub-string from a string using regular expressions. Below is the working code in Python (giving desired results) Python Solution x = r'CAR_2_ABC_547_d' >>> spattern = re.compile("CAR_.*?_(.*)") >>>…
sarbjit
  • 3,786
  • 9
  • 38
  • 60
2
votes
1 answer

simulate diff output using tcl exec diff on two strings

I am trying to produce same output of diff command in tclsh using tcl exec diff on two strings. Could you please let me know how to solve this example using tclsh exec diff Working with Bash $ diff <(echo "Testword") <(echo "Testword2") 1c1 <…
Mallikarjunarao Kosuri
  • 1,023
  • 7
  • 25
  • 52
2
votes
3 answers

Set the terminal tab title as prompt name in unix

Lets say, the prompt is as below run_scripts > How to set that terminal tab title same as prompt i.e Terminal tab tile also should be run_scripts> So that terminal title should dynamically update when the prompt changes.
user1228191
  • 681
  • 3
  • 10
  • 19
1
2 3 4 5 6 7