【发布时间】:2012-09-21 23:12:55
【问题描述】:
我有一个 shell 环境变量 PATH_TO_DIR,我想在 TCL 脚本中检查文件 $PATH_TO_DIR/target.txt 是否存在。
我目前的解决方案是:
catch {exec /usr/local/bin/tcsh -c "echo $PATH_TO_DIR/target.txt" } result
if {![file exists $result]} {
puts "ERROR: the file $result is not exists"
}
我相信还有更优雅的方式。
只用TCL命令怎么解决?
【问题讨论】:
标签: tcl