I have a shell environment variable PATH_TO_DIR and I want to check in TCL script that the file $PATH_TO_DIR/target.txt exists.
My current solution is:
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"
}
I’m sure there is a more elegant way.
How can I solve it only with TCL commands?
1 Answer