ファイルへのパスを含む行を含むファイルがあります。パスにSHELL環境変数が含まれていることがあり、ファイルの存在を確認したい場合があります。以下は私の解決策です:
set fh [open "the_file_contain_path" "r"]
while {![eof $fh]} {
set line [gets $fh]
if {[regexp -- {\$\S+} $line]} {
catch {exec /usr/local/bin/tcsh -c "echo $line" } line
if {![file exists $line]} {
puts "ERROR: the file $line is not exists"
}
}
}
使用せずにもっとエレガントな解決策があると確信しています
/ usr / local / bin / tcsh - c