1

Perl と Tcl は初めてです。既存の Tcl コードを基に独自のスクリプトを作成しようとしています。問題は、tcl スクリプトから既存の perl プログラムを使用しようとすると、次のエラーが発生することです。

***invalid command name "*'"
while executing
"*' \
                    -close '*"
invoked from within
"set command "/usr/local/bin/perl /home/bin/perlscript \
                    -var SOURCE=$myings \
                    -var IN_LA..."***

Tcl スクリプト内のコードは次のようになります。

set command "/usr/local/bin/perl /home/bin/perlscript \
                             -var SOURCE=$myings \
                             -var IN_LAYMAN=TRUE \
                             -open '[*' \
                             -close '*]' \
                             -open '[*' -close '*]' $mygsp -output run.file"

if {   [ file exists $mygsp ] && [file exists $myings ] } {
    if { [catch { open "|$command" } input] } {
           putmsg "Please check the following errors: $::errorInfo"
          } else {
           putmsg " Either the $mygsp or $myings is missing. Please check before   proceeding forward"
             }
}   

問題は、'open' & 'close' または '[*' spl charectors の使用にあると思われます。手伝ってくれますか?

4

1 に答える 1

2

二重引用符で区切られた文字列内のすべての「[」文字をエスケープする必要があります。そうしないと、TCL は [...] ブロック内のコマンドを実行し、結果を文字列に置き換えようとします。

set command "/usr/local/bin/perl /home/bin/perlscript \
                         -var SOURCE=$myings \
                         -var IN_LAYMAN=TRUE \
                         -open '\[*' \
                         -close '*]' \
                         -open '\[*' -close '*]' $mygsp -output run.file"
于 2013-11-07T00:56:26.397 に答える