命令 | 功能 | 举例 |
---|
history -redo -2 | 执行倒数第二条命令 | |
!! | 执行上一条命令 | !6:执行num=6的命令 |
help | 帮助 | help for*:支持匹配 |
man | 帮助 | man topic |
append | 末尾追加字符 | append c1 " " $c2 : $c1 $c2 |
incr | 累加 | incr b -6: 减6 |
unset | 删除变量 | unset a |
info exists | 检查变量是否存在,存在返回1 | info exists cells |
info vars | 检查模糊变量是否存在 | info vars total_c* |
array names env | 查看环境变量数组env | |
echo $env(HOME) | 查看数组里变量值 | |
getev HOME | 同上 | |
source | 执行.tcl | source - echo verbose myrun.tcl |
source - echo verbose myrun.tcl | 重定向脚本输出 | source -echo -verbose myrun.tcl > myrun.out |
字符串命令 | 功能 | 举例 |
---|
string compore | 比较俩个字符串 | string compare string1 string2 |
string toupper | 字符串转化为大写 | string toupper sd |
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/7be96279100507af449647519ab18004.png)
---建立list-----
set D_pins "I1/FF3/D I1/FF4/D I1/FF5/D"
set D_pins {I1/FF3/D I1/FF4/D I1/FF5/D}
set D_pins [list I1/FF3/D I1/FF4/D I1/FF5/D]
---建立嵌套list-----
set compound_list [list {x y} {1 2.5 3.75 4} {red green blue}]
---查看list元素
psyn_shell-t> echo [lindex $D_pins 0]
I1/FF3/D
psyn_shell-t> echo [lindex $compound_list 1]
1 2.5 3.75 4
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/083aba7822010527678d576bd50348d4.png)
特殊字符 | 功能 |
---|
\ | 续行或者转义 |
$ | 访问变量 |
() | 用于组合表达式 |
“” | 声明弱引用 |
{} | 表示强引用,不能替换 |
; | 命令分割 |
# | 注释 |
[] | 替换 |
下面展示一些 内联代码片
。
dc_shell-t> set a 5; set b 10
10
dc_shell-t> echo {[expr $b - $a]} evaluates to [expr $b - $a]
[expr $b - $a] evaluates to 5