tcl

How to automate console scenario using TCL script? [closed]

邮差的信 提交于 2019-12-30 11:32:07
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I want to automate the following scenario: Login into a router Give reload When reloading a router, press ESP key continuously. When pressing a ESP key , boot> prompt will come. execute some commands in this. I can do the above things manually, using "Teraterm" and console. But

TCL : Concatenate a variable and a string

ⅰ亾dé卋堺 提交于 2019-12-30 05:43:08
问题 Assume we have a variable 'a' set to 12345 : set a 12345 Now how do i set a new variable 'b' which contains the value of 'a' and another string say 9876 workaround is something like set a "12345" set u "9876" set b $a$u but i dont want to specify $u instead i want the direct string to used.. 回答1: You can do: set b ${a}9876 or, assuming b is either set to the empty string or not defined: append b $a 9876 The call to append is more efficient when $a is long (see append doc). 回答2: other option

Determine type of a variable in Tcl

时光总嘲笑我的痴心妄想 提交于 2019-12-30 02:11:39
问题 I'm looking for a way to find the type of a variable in Tcl. For example if I have the variable $a and I want to know whether it is an integer. I have been using the following so far: if {[string is boolean $a]} { #do something } and this seems to work great for the following types: alnum, alpha, ascii, boolean, control, digit, double, false, graph, integer, lower, print, punct, space, true, upper, wordchar, xdigit However it is not capable to tell me if my variable might be an array, a list

Displaying emojis/symbols in Python using tkinter lib

天大地大妈咪最大 提交于 2019-12-28 18:39:25
问题 Does Tkinter support 16bit range characters, because I can not print emojis in the gui, when printing in python terminal, it works fine >> print("😊") >> 😊 but in tkinter, it shows this error: _tkinter.TclError: character U+1f618 is above the range (U+0000-U+FFFF) allowed by Tcl 回答1: There's a bug in Tkinter that it doesn't transparently map this for you, and definitely a bug in the underlying libraries (Tcl and Tk) that the string is not accepted as is and needs intervention at all. The state

Running multiple instances of one tcl script

荒凉一梦 提交于 2019-12-26 03:33:36
问题 Currently I am reading in host names from a file using a foreach command and using this hostname to connect to the device. All this is done within my TCL script. Is there a way I can run multiple instances of the script so that each device is queried separately? Something like a bash script similar to: for hostname in file; do log.tcl $hostname & done I believe this is similar to multi threading. Another question I have is that, when running multiple instances of a script, and each script

Running multiple instances of one tcl script

北战南征 提交于 2019-12-26 03:33:12
问题 Currently I am reading in host names from a file using a foreach command and using this hostname to connect to the device. All this is done within my TCL script. Is there a way I can run multiple instances of the script so that each device is queried separately? Something like a bash script similar to: for hostname in file; do log.tcl $hostname & done I believe this is similar to multi threading. Another question I have is that, when running multiple instances of a script, and each script

Copying Multiple Files in TCL using glob

依然范特西╮ 提交于 2019-12-25 18:37:35
问题 I want to copy all files from one folder using tcl. This is the code that I have written so far, but it does not work. What is the problem? set files [glob -dir E:\Music *] puts "Moving files" foreach f { $files } { file copy $f E:\ } 回答1: My earlier assumption was wrong, and I unfortunately didn't notice that you were using braces around $files . Unlike languages like C, where parentheses or braces are part of syntactic constructions, braces are used for quoting in Tcl. In this case, $files

Tcl rename of the proc keyword doesn't work in namespaces in Tcl C library

你离开我真会死。 提交于 2019-12-25 16:56:44
问题 I have the following procedure: rename proc _proc _proc proc {name args body} { global pass_log_trace set g_log_trace "0" if {[info exists pass_log_trace]} { set g_log_trace $pass_log_trace } # simple check if we have double declaration of the same procedure if {[info procs $name] != ""} { puts "\nERROR: redeclaration of procedure: $name" } _proc $name $args $body if {$g_log_trace != 0} { trace add execution $name enter trace_report_enter trace add execution $name leave trace_report_leave } }

TCL grabbing words within special boundaries

﹥>﹥吖頭↗ 提交于 2019-12-25 16:43:25
问题 Objection : get the all words within the "{" "}" boundary. input_file.txt: set_false_path -from [get_ports {a/b[1] ab/cd_1 abcd_1_ad_}] -through [get_pins {th/th1 th2/th2[2]}] set_derate -whatever [get_ports {xxx/xx1 xxx xxxx_1}] set_false_path 3 -to [get_pins {aaa/d aaa/b}] -from [get_abc {abc/ac/dd nnn_2/2}] expected output_file.txt: a/b[1] ab/cd_1 abcd_1_ad_ th/th1 th2/th2[2] aaa/d aaa/b abc/ac/dd nnn_2/2 NB: there might be two or more pair of "{" "}" , and I want to grab all of those

linux - telnet - script with expect

本小妞迷上赌 提交于 2019-12-25 16:25:47
问题 I was writing an expect-script which communicate with a server via telnet, but right now i need to evaluate the reply from server. Usage: ./edit.expect EXPECT script: #!/usr/bin/expect<br> spawn telnet ip port expect "HUH?" send "login testuser pass\r" expect "good" send "select 1\r" expect "good" send "me\r" expect "nick=testuser id=ID group=testgroup login=testuser" send "edit id=ID group=3\r" expect "good" send "quit\r" If i send the command "me" i get a reply from the server which i need