小编use*_*933的帖子

获取TCL中执行代码的行号

如何打印执行TCL脚本的行号?

#! /usr/bin/tclsh

set a "100"
set b "200"
set c [expr $a + $b]
puts [info script] ;# it will display the script name which it is executing. 
                    # similarly I need to print the script line number.
puts $c
Run Code Online (Sandbox Code Playgroud)

tcl

2
推荐指数
1
解决办法
4138
查看次数

如何在命令行参数中使用尖括号?

如何在命令行参数中使用尖括号?

假设输入是: filename -w <input.txt>

input.txt是第二个命令行参数,它是程序的输入文件,这里 input.txt 必须用尖括号( <input.txt>)括起来。但是如果我使用尖括号,我就会出错。错误是:

sh: -c: line 0: syntax error near unexpected token `newline'
sh: -c: line 0: `demo -w '
Run Code Online (Sandbox Code Playgroud)

tcl

0
推荐指数
1
解决办法
2165
查看次数

标签 统计

tcl ×2