tcl

How to `rm -rf *` in TCL

北城余情 提交于 2021-01-28 02:04:54
问题 I want to delete all files in a directory using TCL. (I'm using Xilinx Vivado's TCL console under Win 10.) I found that in TCL documentation that file delete ?-force? ?- -? pathname ?pathname ... ? should work. But file delete -force -- [glob *] does nothing. What's the wrong with that? 回答1: Make that file delete -force -- {*}[glob *] ... so that the path names returned by [glob] are turned into multiple arguments to [file delete] (using the expansion operator {*} ), rather than one argument

tcl: how to use the value of a variable to create a new variable

﹥>﹥吖頭↗ 提交于 2021-01-02 19:17:08
问题 here is an example of what I'm trying to do. set t SNS set ${t}_top [commands that return value] Want to get the info stored at ${t}_top puts “${t}_top”  SNS_top (really want the data stored there?) Thought it was : ${{$t}_top} , maybe that was perl but {} inside the {} do not work. 回答1: One of the really interesting things about Tcl is that you can create variable names dynamically, as you are doing in the question you posted. However, this makes it tricky to write and makes your code

tcl: how to use the value of a variable to create a new variable

泄露秘密 提交于 2021-01-02 19:15:53
问题 here is an example of what I'm trying to do. set t SNS set ${t}_top [commands that return value] Want to get the info stored at ${t}_top puts “${t}_top”  SNS_top (really want the data stored there?) Thought it was : ${{$t}_top} , maybe that was perl but {} inside the {} do not work. 回答1: One of the really interesting things about Tcl is that you can create variable names dynamically, as you are doing in the question you posted. However, this makes it tricky to write and makes your code

How to get Command history by cursor key in Linux tclsh

不羁的心 提交于 2020-12-29 02:45:41
问题 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. 回答1: 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' 回答2: I usually

How to get Command history by cursor key in Linux tclsh

荒凉一梦 提交于 2020-12-29 02:45:26
问题 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. 回答1: 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' 回答2: I usually

How to write a Tcl script which will create a list of models and subcircuit names

拜拜、爱过 提交于 2020-12-15 05:12:25
问题 I got stuck in a Tcl script which will create a list of models and subcircuit names contained within a Spice .lib file: The name of the .lib file should be given on the command line . the file looks like the following: .model Q2N2222 NPN(Is=14.34f Xti=3 Eg=1.11 Vaf=74.03 Bf=255.9 Ne=1.307 + Ise=14.34f Ikf=.2847 Xtb=1.5 Br=6.092 Nc=2 Isc=0 Ikr=0 Rc=1 + Cjc=7.306p Mjc=.3416 Vjc=.75 Fc=.5 Cje=22.01p Mje=.377 Vje=.75 + Tr=46.91n Tf=411.1p Itf=.6 Vtf=1.7 Xtf=3 Rb=10) * National pid=19 case=TO18 *

unable to spawn ssh using TCL expect in ActiveTCL

烂漫一生 提交于 2020-12-06 18:53:08
问题 I am trying to ssh through .tcl script from ActiveState TCL 'tclsh' window. Having WINDOWS OS system. #!/bin/sh # \ exec tclsh "$0" ${1+"$@"} package require Expect set user [lindex $argv 0] set password [lindex $argv 1] set DeviceIpAddr [lindex $argv 2] set DeviceHostName [lindex $argv 3] foreach DeviceIp $DeviceIpAddr HostName $DeviceHostName { spawn ssh $DeviceIp expect "login as:" send "$user\r" expect "Password:" send "$password\r" expect "$HostName ~]#" } I see below error while execute

How I add bracket in string variable in TCL file

末鹿安然 提交于 2020-11-29 21:06:47
问题 I have written one TCL script but I have one problem when making a string variable as below: set a 100 set b "this is variable[$a]" I want b to be assign with b = " this is variable[100] " but I got the error: invalid command name 100 Please help me to fix it :-(. 回答1: You just need to escape it: set a 100 set b "this is variable\[$a\]" 回答2: Other possibilities (but escaping the brackets is better): set b [format {this is variable[%d]} $a] set b [subst -nocom -noback {this is variable[$a]}]